exampleReader02.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. error_reporting(E_ALL);
  3. set_time_limit(0);
  4. date_default_timezone_set('Europe/London');
  5. /** Include path **/
  6. set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
  7. /** PHPExcel_IOFactory */
  8. include 'PHPExcel/IOFactory.php';
  9. ?>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  13. <title>PHPExcel Reader Example #02</title>
  14. </head>
  15. <body>
  16. <h1>PHPExcel Reader Example #02</h1>
  17. <h2>Simple File Reader using a Specified Reader</h2>
  18. <?php
  19. $inputFileName = './sampleData/example1.xls';
  20. echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using PHPExcel_Reader_Excel5<br />';
  21. $objReader = new PHPExcel_Reader_Excel5();
  22. // $objReader = new PHPExcel_Reader_Excel2007();
  23. // $objReader = new PHPExcel_Reader_Excel2003XML();
  24. // $objReader = new PHPExcel_Reader_OOCalc();
  25. // $objReader = new PHPExcel_Reader_SYLK();
  26. // $objReader = new PHPExcel_Reader_Gnumeric();
  27. // $objReader = new PHPExcel_Reader_CSV();
  28. $objPHPExcel = $objReader->load($inputFileName);
  29. echo '<hr />';
  30. $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
  31. var_dump($sheetData);
  32. ?>
  33. <body>
  34. </html>