ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
28iterator.php
Go to the documentation of this file.
1 <?php
29 error_reporting(E_ALL);
30 ini_set('display_errors', TRUE);
31 ini_set('display_startup_errors', TRUE);
32 
33 define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
34 
35 date_default_timezone_set('Europe/London');
36 
38 require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
39 
40 
41 if (!file_exists("05featuredemo.xlsx")) {
42  exit("Please run 05featuredemo.php first." . EOL);
43 }
44 
45 echo date('H:i:s') , " Load from Excel2007 file" , EOL;
47 $objPHPExcel = $objReader->load("05featuredemo.xlsx");
48 
49 echo date('H:i:s') , " Iterate worksheets" , EOL;
50 foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
51  echo 'Worksheet - ' , $worksheet->getTitle() , EOL;
52 
53  foreach ($worksheet->getRowIterator() as $row) {
54  echo ' Row number - ' , $row->getRowIndex() , EOL;
55 
56  $cellIterator = $row->getCellIterator();
57  $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
58  foreach ($cellIterator as $cell) {
59  if (!is_null($cell)) {
60  echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL;
61  }
62  }
63  }
64 }
65 
66 
67 // Echo memory peak usage
68 echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
$worksheet
$objReader
Definition: 28iterator.php:46
static createReader($readerType='')
Create PHPExcel_Reader_IReader.
Definition: IOFactory.php:161
if($is_dev) echo "Review changes write something in WHATSNEW and and then commit with log PHP_EOL
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
const EOL
Definition: 28iterator.php:33
$objPHPExcel
Definition: 28iterator.php:47