Phpexcel.php 708 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\test\controller;
  3. use app\common\server\PhpExcel as PhpExcelServer;
  4. class Phpexcel
  5. {
  6. public function test()
  7. {
  8. $s_pes = new PhpExcelServer();
  9. $title = [
  10. ['cell' => 'A1', 'value' => '测试1'],
  11. ['cell' => 'B1', 'value' => '测试2'],
  12. ];
  13. $body = [
  14. [
  15. 'test1' => ['cell' => 'A2', "value" => 2],
  16. 'test2' => ['cell' => 'B2', "value" => 5],
  17. ],
  18. ];
  19. $exportData = [
  20. 'title' => $title,
  21. 'body' => $body,
  22. ];
  23. $s_pes->setmararycache();
  24. $s_pes->getsheetobj($body, $title);
  25. $s_pes->sevefile('test.xml');
  26. }
  27. }