default_format.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. $excel->fileName('tutorial.xlsx');
  10. $format = new \Vtiful\Kernel\Format($excel->getHandle());
  11. $colorOneStyle = $format
  12. ->fontColor(\Vtiful\Kernel\Format::COLOR_ORANGE)
  13. ->border(\Vtiful\Kernel\Format::BORDER_DASH_DOT)
  14. ->toResource();
  15. $format = new \Vtiful\Kernel\Format($excel->getHandle());
  16. $colorTwoStyle = $format
  17. ->fontColor(\Vtiful\Kernel\Format::COLOR_GREEN)
  18. ->toResource();
  19. $filePath = $excel
  20. // Apply the first style as the default
  21. ->defaultFormat($colorOneStyle)
  22. ->header(['hello', 'xlswriter'])
  23. // Apply the second style as the default style
  24. ->defaultFormat($colorTwoStyle)
  25. ->data([
  26. ['hello', 'xlswriter'],
  27. ])
  28. ->output();
  29. var_dump($filePath);
  30. ?>
  31. --CLEAN--
  32. <?php
  33. @unlink(__DIR__ . '/tutorial.xlsx');
  34. ?>
  35. --EXPECT--
  36. string(21) "./tests/tutorial.xlsx"