No Description

exampleReader19.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. error_reporting(E_ALL);
  3. set_time_limit(0);
  4. date_default_timezone_set('Europe/London');
  5. ?>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>PHPExcel Reader Example #19</title>
  10. </head>
  11. <body>
  12. <h1>PHPExcel Reader Example #19</h1>
  13. <h2>Reading WorkSheet information without loading entire file</h2>
  14. <?php
  15. /** Include path **/
  16. set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
  17. /** PHPExcel_IOFactory */
  18. include 'PHPExcel/IOFactory.php';
  19. $inputFileType = 'Excel5';
  20. // $inputFileType = 'Excel2007';
  21. // $inputFileType = 'Excel2003XML';
  22. // $inputFileType = 'OOCalc';
  23. // $inputFileType = 'Gnumeric';
  24. $inputFileName = './sampleData/example1.xls';
  25. echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />';
  26. $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  27. $worksheetData = $objReader->listWorksheetInfo($inputFileName);
  28. echo '<h3>Worksheet Information</h3>';
  29. echo '<ol>';
  30. foreach ($worksheetData as $worksheet) {
  31. echo '<li>', $worksheet['worksheetName'], '<br />';
  32. echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '<br />';
  33. echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows'];
  34. echo '</li>';
  35. }
  36. echo '</ol>';
  37. ?>
  38. <body>
  39. </html>