format_align.phpt 844 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $config = [
  8. 'path' => './tests'
  9. ];
  10. $fileObject = new \Vtiful\Kernel\Excel($config);
  11. $fileObject = $fileObject->fileName('tutorial.xlsx');
  12. $fileHandle = $fileObject->getHandle();
  13. $format = new \Vtiful\Kernel\Format($fileHandle);
  14. $alignStyle = $format->align(
  15. \Vtiful\Kernel\Format::FORMAT_ALIGN_CENTER,
  16. \Vtiful\Kernel\Format::FORMAT_ALIGN_VERTICAL_CENTER
  17. )->toResource();
  18. $filePath = $fileObject->header(['name', 'age'])
  19. ->data([
  20. ['viest', 21],
  21. ['wjx', 21]
  22. ])
  23. ->setRow('A1', 50, $alignStyle)
  24. ->setRow('A2:A3', 50, $alignStyle)
  25. ->output();
  26. var_dump($filePath);
  27. ?>
  28. --CLEAN--
  29. <?php
  30. @unlink(__DIR__ . '/tutorial.xlsx');
  31. ?>
  32. --EXPECT--
  33. string(21) "./tests/tutorial.xlsx"