exampleWorkBookReader02.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Reading WorkBook Data Example #02</title>
  10. </head>
  11. <body>
  12. <h1>PHPExcel Reading WorkBook Data Example #02</h1>
  13. <h2>Read a list of Custom Properties for a WorkBook</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 = 'Excel2007';
  20. $inputFileName = './sampleData/example1.xlsx';
  21. /** Create a new Reader of the type defined in $inputFileType **/
  22. $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  23. /** Load $inputFileName to a PHPExcel Object **/
  24. $objPHPExcel = $objReader->load($inputFileName);
  25. echo '<hr />';
  26. /** Read an array list of any custom properties for this document **/
  27. $customPropertyList = $objPHPExcel->getProperties()->getCustomProperties();
  28. echo '<b>Custom Property names: </b><br />';
  29. foreach($customPropertyList as $customPropertyName) {
  30. echo $customPropertyName,'<br />';
  31. }
  32. ?>
  33. <body>
  34. </html>