insert_text_resource_format.phpt 783 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $config = ['path' => './tests'];
  8. $excel = new \Vtiful\Kernel\Excel($config);
  9. $textFile = $excel->fileName("tutorial01.xlsx")
  10. ->header(['name', 'age']);
  11. $fileHandle = $textFile->getHandle();
  12. $format = new \Vtiful\Kernel\Format($fileHandle);
  13. $colorStyle = $format->fontColor(\Vtiful\Kernel\Format::COLOR_ORANGE)->toResource();
  14. for ($index = 0; $index < 10; $index++) {
  15. $textFile->insertText($index+1, 0, 'vikin');
  16. $textFile->insertText($index+1, 1, 1000, '#,##0', $colorStyle);
  17. }
  18. $filePath = $textFile->output();
  19. var_dump($filePath);
  20. ?>
  21. --CLEAN--
  22. <?php
  23. @unlink(__DIR__ . '/tutorial01.xlsx');
  24. ?>
  25. --EXPECT--
  26. string(23) "./tests/tutorial01.xlsx"