insertText_demo.php 445 B

123456789101112131415161718
  1. <?php
  2. /**
  3. * 文本插入demo
  4. */
  5. require_once(__DIR__ . '/../vendor/autoload.php');
  6. use Pxlswrite\Pxlswrite;
  7. $fileObj = new Pxlswrite(['path' => __DIR__ . '/uploads']);
  8. $fileObj->fileName("insertText.xlsx")
  9. ->header(['name', 'money']);
  10. for ($index = 0; $index < 10; $index++) {
  11. $fileObj->insertText($index+1, 0, 'viest');
  12. $fileObj->insertText($index+1, 1, 10000, '#,##0'); // #,##0 为单元格数据样式
  13. }
  14. $fileObj->output();