From a4d7997356a46c522ec7bfb2cda428a67d745b40 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 30 Apr 2015 23:55:27 +0100 Subject: [PATCH 1/6] version function --- Classes/PHPExcel/Calculation/Functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/PHPExcel/Calculation/Functions.php b/Classes/PHPExcel/Calculation/Functions.php index 7f6240141..dea1503b8 100644 --- a/Classes/PHPExcel/Calculation/Functions.php +++ b/Classes/PHPExcel/Calculation/Functions.php @@ -496,7 +496,7 @@ public static function IS_NONTEXT($value = NULL) { * @return string Version information */ public static function VERSION() { - return 'PHPExcel ##VERSION##, ##DATE##'; + return 'PHPExcel 1.8.1, 2015-04-30'; } // function VERSION() From c9f2ee522bdddf443845bdedb8e77e3ff8799c6e Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 1 May 2015 08:00:24 +0100 Subject: [PATCH 2/6] Abstract function PHPExcel_Worksheet_CellIterator::adjustForExistingOnlyRange() cannot contain body --- Classes/PHPExcel/Worksheet/CellIterator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Worksheet/CellIterator.php b/Classes/PHPExcel/Worksheet/CellIterator.php index 77c5d2e31..239cb4ff1 100644 --- a/Classes/PHPExcel/Worksheet/CellIterator.php +++ b/Classes/PHPExcel/Worksheet/CellIterator.php @@ -79,8 +79,7 @@ public function getIterateOnlyExistingCells() { * * @throws PHPExcel_Exception */ - abstract protected function adjustForExistingOnlyRange() { - } + abstract protected function adjustForExistingOnlyRange(); /** * Set the iterator to loop only existing cells From 0cdda0dc4288647832daf3d0cd8a5421e349f92f Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Mon, 4 May 2015 23:34:36 +0100 Subject: [PATCH 3/6] Fix to case-sensitivity in getCell() method when using a worksheet!cell reference --- Classes/PHPExcel/Worksheet.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 2b0b57ae4..909f52575 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -1152,7 +1152,6 @@ public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pVa */ public function getCell($pCoordinate = 'A1') { - $pCoordinate = strtoupper($pCoordinate); // Check cell collection if ($this->_cellCollection->isDataSet($pCoordinate)) { return $this->_cellCollection->getCacheData($pCoordinate); @@ -1161,7 +1160,7 @@ public function getCell($pCoordinate = 'A1') // Worksheet reference? if (strpos($pCoordinate, '!') !== false) { $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); - return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]); + return $this->_parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1])); } // Named range? From 8d3548adb09bf183747d7019b928faa92c159792 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Mon, 4 May 2015 23:40:44 +0100 Subject: [PATCH 4/6] New calculation example with cyclic formula --- Examples/13calculationCyclicFormulae.php | 97 ++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Examples/13calculationCyclicFormulae.php diff --git a/Examples/13calculationCyclicFormulae.php b/Examples/13calculationCyclicFormulae.php new file mode 100644 index 000000000..8512a3e85 --- /dev/null +++ b/Examples/13calculationCyclicFormulae.php @@ -0,0 +1,97 @@ +'); + +date_default_timezone_set('Europe/London'); + +/** Include PHPExcel */ +require_once dirname(__FILE__) . '/../Classes/PHPExcel.php'; + + +// Create new PHPExcel object +echo date('H:i:s') , " Create new PHPExcel object" , EOL; +$objPHPExcel = new PHPExcel(); + +// Add some data, we will use some formulas here +echo date('H:i:s') , " Add some data and formulas" , EOL; +$objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1') + ->setCellValue('A2', '=B2+1') + ->setCellValue('B1', '=A1+1') + ->setCellValue('B2', '=A2'); + +PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100; + +// Calculated data +echo date('H:i:s') , " Calculated data" , EOL; +for($row = 1; $row <= 2; ++$row) { + for ($col = 'A'; $col != 'C'; ++$col) { + if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && + ($formula[0] == '=')) { + echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , + $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; + } + } +} + + +// Save Excel 2007 file +echo date('H:i:s') , " Write to Excel2007 format" , EOL; +$callStartTime = microtime(true); + +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); + +// +// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the +// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae +// using functions or features (such as array formulae) that aren't yet supported by the calculation engine +// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to +// open the file) will need to recalculate values itself to guarantee that the correct results are available. +// +//$objWriter->setPreCalculateFormulas(true); +$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); +$callEndTime = microtime(true); +$callTime = $callEndTime - $callStartTime; + +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; +echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; +// Echo memory usage +echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; + + +// Echo memory peak usage +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; + +// Echo done +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; From 049e85ae98a90869e1bc83087f755010e9223091 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Tue, 5 May 2015 01:10:25 +0100 Subject: [PATCH 5/6] Remove spurious setLineEnding() from csv example --- Examples/16csv.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Examples/16csv.php b/Examples/16csv.php index 71ebfd00d..ca3f28d70 100644 --- a/Examples/16csv.php +++ b/Examples/16csv.php @@ -46,7 +46,6 @@ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',') ->setEnclosure('"') - ->setLineEnding("\r\n") ->setSheetIndex(0) ->save(str_replace('.php', '.csv', __FILE__)); $callEndTime = microtime(true); @@ -61,7 +60,6 @@ $callStartTime = microtime(true); $objReader = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',') ->setEnclosure('"') - ->setLineEnding("\r\n") ->setSheetIndex(0); $objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__)); From c193da78f7f6cbda00f7fba71e71a9c35d621231 Mon Sep 17 00:00:00 2001 From: Damien Seguy Date: Tue, 19 May 2015 14:16:50 +0200 Subject: [PATCH 6/6] Remove concatenation --- Classes/PHPExcel/Chart/Renderer/jpgraph.php | 2 +- .../Examples/Calculations/Database/DAVERAGE.php | 8 ++++---- .../Examples/Calculations/Database/DCOUNT.php | 8 ++++---- .../Examples/Calculations/Database/DGET.php | 10 +++++----- .../Examples/Calculations/Database/DMAX.php | 10 +++++----- .../Examples/Calculations/Database/DMIN.php | 10 +++++----- .../Examples/Calculations/Database/DPRODUCT.php | 10 +++++----- .../Examples/Calculations/Database/DSTDEV.php | 8 ++++---- .../Examples/Calculations/Database/DSTDEVP.php | 8 ++++---- .../Examples/Calculations/Database/DVAR.php | 8 ++++---- .../Examples/Calculations/Database/DVARP.php | 8 ++++---- Documentation/Examples/Calculations/index.php | 2 +- Documentation/Examples/index.php | 2 +- Examples/10autofilter-selection-1.php | 16 ++++++++-------- Examples/10autofilter-selection-2.php | 16 ++++++++-------- Examples/10autofilter-selection-display.php | 16 ++++++++-------- Examples/10autofilter.php | 14 +++++++------- Examples/13calculation.php | 2 +- Examples/18extendedcalculation.php | 14 +++++++------- Examples/26utf8.php | 10 +++++----- Examples/31docproperties_write-xls.php | 4 ++-- Examples/31docproperties_write.php | 4 ++-- Examples/40duplicateStyle.php | 2 +- Examples/Quadratic.php | 8 ++++---- Examples/Quadratic2.php | 8 ++++---- Examples/runall.php | 4 ++-- unitTests/bootstrap.php | 2 +- 27 files changed, 107 insertions(+), 107 deletions(-) diff --git a/Classes/PHPExcel/Chart/Renderer/jpgraph.php b/Classes/PHPExcel/Chart/Renderer/jpgraph.php index 99a0b97ad..0c6e8a7ae 100644 --- a/Classes/PHPExcel/Chart/Renderer/jpgraph.php +++ b/Classes/PHPExcel/Chart/Renderer/jpgraph.php @@ -833,7 +833,7 @@ public function render($outputDestination) { $this->_renderStockChart($groupCount,$dimensions); break; default : - echo $chartType.' is not yet implemented
'; + echo $chartType,' is not yet implemented
'; return false; } $this->_renderLegend(); diff --git a/Documentation/Examples/Calculations/Database/DAVERAGE.php b/Documentation/Examples/Calculations/Database/DAVERAGE.php index adf4636c5..efaaf66ee 100644 --- a/Documentation/Examples/Calculations/Database/DAVERAGE.php +++ b/Documentation/Examples/Calculations/Database/DAVERAGE.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DAVERAGE() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DAVERAGE() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DAVERAGE() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DAVERAGE() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DCOUNT.php b/Documentation/Examples/Calculations/Database/DCOUNT.php index ece2b1f30..679f2b2de 100644 --- a/Documentation/Examples/Calculations/Database/DCOUNT.php +++ b/Documentation/Examples/Calculations/Database/DCOUNT.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DCOUNT() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DCOUNT() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DCOUNT() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DCOUNT() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DGET.php b/Documentation/Examples/Calculations/Database/DGET.php index 51d7dd61b..ba117e6cd 100644 --- a/Documentation/Examples/Calculations/Database/DGET.php +++ b/Documentation/Examples/Calculations/Database/DGET.php @@ -67,18 +67,18 @@ // Test the formulae echo '

Criteria

'; -echo 'ALL' . '

'; +echo 'ALL' , '

'; -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DMAX.php b/Documentation/Examples/Calculations/Database/DMAX.php index 1a2d22a49..81c937522 100644 --- a/Documentation/Examples/Calculations/Database/DMAX.php +++ b/Documentation/Examples/Calculations/Database/DMAX.php @@ -70,18 +70,18 @@ // Test the formulae echo '

Criteria

'; -echo 'ALL' . '

'; +echo 'ALL' , '

'; -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DMIN.php b/Documentation/Examples/Calculations/Database/DMIN.php index d6f23a6a4..514c4138c 100644 --- a/Documentation/Examples/Calculations/Database/DMIN.php +++ b/Documentation/Examples/Calculations/Database/DMIN.php @@ -70,18 +70,18 @@ // Test the formulae echo '

Criteria

'; -echo 'ALL' . '

'; +echo 'ALL' , '

'; -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DMIN() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DMIN() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DMIN() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DPRODUCT.php b/Documentation/Examples/Calculations/Database/DPRODUCT.php index e5e629edb..e592888b0 100644 --- a/Documentation/Examples/Calculations/Database/DPRODUCT.php +++ b/Documentation/Examples/Calculations/Database/DPRODUCT.php @@ -68,18 +68,18 @@ // Test the formulae echo '

Criteria

'; -echo 'ALL' . '

'; +echo 'ALL' , '

'; -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DMAX() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DSTDEV.php b/Documentation/Examples/Calculations/Database/DSTDEV.php index c26df0e92..9ecc7547f 100644 --- a/Documentation/Examples/Calculations/Database/DSTDEV.php +++ b/Documentation/Examples/Calculations/Database/DSTDEV.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DSTDEV() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DSTDEV() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DSTDEV() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DSTDEV() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DSTDEVP.php b/Documentation/Examples/Calculations/Database/DSTDEVP.php index 9b353454d..e23cd2ad7 100644 --- a/Documentation/Examples/Calculations/Database/DSTDEVP.php +++ b/Documentation/Examples/Calculations/Database/DSTDEVP.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DSTDEVP() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DSTDEVP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DSTDEVP() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DVAR.php b/Documentation/Examples/Calculations/Database/DVAR.php index e425f776f..1b8db3ba2 100644 --- a/Documentation/Examples/Calculations/Database/DVAR.php +++ b/Documentation/Examples/Calculations/Database/DVAR.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DVAR() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DVAR() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DVAR() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/Database/DVARP.php b/Documentation/Examples/Calculations/Database/DVARP.php index e1cfc8e37..3874dec8d 100644 --- a/Documentation/Examples/Calculations/Database/DVARP.php +++ b/Documentation/Examples/Calculations/Database/DVARP.php @@ -73,16 +73,16 @@ $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A12")->getValue() .'
'; -echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'

'; +echo $worksheet->getCell("A12")->getValue() ,'
'; +echo 'DVARP() Result is ' , $worksheet->getCell("B12")->getCalculatedValue() ,'

'; echo '

Criteria

'; $criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); var_dump($criteriaData); -echo $worksheet->getCell("A13")->getValue() .'
'; -echo 'DVARP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); +echo $worksheet->getCell("A13")->getValue() ,'
'; +echo 'DVARP() Result is ' , $worksheet->getCell("B13")->getCalculatedValue(); ?> diff --git a/Documentation/Examples/Calculations/index.php b/Documentation/Examples/Calculations/index.php index f09055308..20b397f3e 100644 --- a/Documentation/Examples/Calculations/index.php +++ b/Documentation/Examples/Calculations/index.php @@ -23,7 +23,7 @@ foreach($exampleTypeList as $exampleType) { - echo '

' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples

'; + echo '

' , pathinfo($exampleType,PATHINFO_BASENAME) , ' Function Examples

'; $exampleList = glob('./'.$exampleType.'/*.php'); diff --git a/Documentation/Examples/index.php b/Documentation/Examples/index.php index f657a7ac6..1ca0e9ad5 100644 --- a/Documentation/Examples/index.php +++ b/Documentation/Examples/index.php @@ -21,7 +21,7 @@ foreach($exampleTypeList as $exampleType) { - echo '

PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples

'; + echo '

PHPExcel ' , pathinfo($exampleType,PATHINFO_BASENAME) , ' Examples

'; $exampleList = glob('./'.$exampleType.'/*.php'); diff --git a/Examples/10autofilter-selection-1.php b/Examples/10autofilter-selection-1.php index 7542a5295..8dbae42c9 100644 --- a/Examples/10autofilter-selection-1.php +++ b/Examples/10autofilter-selection-1.php @@ -38,11 +38,11 @@ // Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; +echo date('H:i:s'),' Create new PHPExcel object',EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s').' Set document properties'.EOL; +echo date('H:i:s'),' Set document properties',EOL; $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') ->setLastModifiedBy('Maarten Balliauw') ->setTitle('PHPExcel Test Document') @@ -52,7 +52,7 @@ ->setCategory('Test result file'); // Create the worksheet -echo date('H:i:s').' Add data'.EOL; +echo date('H:i:s'),' Add data',EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') ->setCellValue('B1', 'Financial Period') @@ -111,7 +111,7 @@ // Set styling -echo date('H:i:s').' Set styling'.EOL; +echo date('H:i:s'),' Set styling',EOL; $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); @@ -124,7 +124,7 @@ // Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; +echo date('H:i:s'),' Set autofilter range',EOL; // Always include the complete filter range! // Excel does support setting only the caption // row, but that's not a best practise... @@ -132,7 +132,7 @@ // Set active filters $autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; +echo date('H:i:s'),' Set active filters',EOL; // Filter the Country column on a filter value of countries beginning with the letter U (or Japan) // We use * as a wildcard, so specify as U* and using a wildcard requires customFilter $autoFilter->getColumn('C') @@ -214,8 +214,8 @@ // Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; +echo date('H:i:s'),' Peak memory usage: ',(memory_get_peak_usage(true) / 1024 / 1024),' MB',EOL; // Echo done -echo date('H:i:s').' Done writing files'.EOL; +echo date('H:i:s'),' Done writing files',EOL; echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/10autofilter-selection-2.php b/Examples/10autofilter-selection-2.php index c89173f5c..a006f7a23 100644 --- a/Examples/10autofilter-selection-2.php +++ b/Examples/10autofilter-selection-2.php @@ -38,11 +38,11 @@ // Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; +echo date('H:i:s'),' Create new PHPExcel object',EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s').' Set document properties'.EOL; +echo date('H:i:s'),' Set document properties',EOL; $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') ->setLastModifiedBy('Maarten Balliauw') ->setTitle('PHPExcel Test Document') @@ -52,7 +52,7 @@ ->setCategory('Test result file'); // Create the worksheet -echo date('H:i:s').' Add data'.EOL; +echo date('H:i:s'),' Add data',EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') ->setCellValue('B1', 'Financial Period') @@ -111,7 +111,7 @@ // Set styling -echo date('H:i:s').' Set styling'.EOL; +echo date('H:i:s'),' Set styling',EOL; $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); @@ -124,7 +124,7 @@ // Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; +echo date('H:i:s'),' Set autofilter range',EOL; // Always include the complete filter range! // Excel does support setting only the caption // row, but that's not a best practise... @@ -132,7 +132,7 @@ // Set active filters $autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; +echo date('H:i:s'),' Set active filters',EOL; // Filter the Country column on a filter value of Germany // As it's just a simple value filter, we can use FILTERTYPE_FILTER $autoFilter->getColumn('C') @@ -206,8 +206,8 @@ // Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; +echo date('H:i:s'),' Peak memory usage: ',(memory_get_peak_usage(true) / 1024 / 1024),' MB',EOL; // Echo done -echo date('H:i:s').' Done writing files'.EOL; +echo date('H:i:s'),' Done writing files',EOL; echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/10autofilter-selection-display.php b/Examples/10autofilter-selection-display.php index cf2b8acfd..4e07d3cd6 100644 --- a/Examples/10autofilter-selection-display.php +++ b/Examples/10autofilter-selection-display.php @@ -38,11 +38,11 @@ // Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; +echo date('H:i:s'),' Create new PHPExcel object',EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s').' Set document properties'.EOL; +echo date('H:i:s'),' Set document properties',EOL; $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') ->setLastModifiedBy('Maarten Balliauw') ->setTitle('PHPExcel Test Document') @@ -52,7 +52,7 @@ ->setCategory('Test result file'); // Create the worksheet -echo date('H:i:s').' Add data'.EOL; +echo date('H:i:s'),' Add data',EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') ->setCellValue('B1', 'Financial Period') @@ -111,7 +111,7 @@ // Set styling -echo date('H:i:s').' Set styling'.EOL; +echo date('H:i:s'),' Set styling',EOL; $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); @@ -124,7 +124,7 @@ // Set autofilter range -echo date('H:i:s').' Set autofilter range'.EOL; +echo date('H:i:s'),' Set autofilter range',EOL; // Always include the complete filter range! // Excel does support setting only the caption // row, but that's not a best practise... @@ -132,7 +132,7 @@ // Set active filters $autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); -echo date('H:i:s').' Set active filters'.EOL; +echo date('H:i:s'),' Set active filters',EOL; // Filter the Country column on a filter value of countries beginning with the letter U (or Japan) // We use * as a wildcard, so specify as U* and using a wildcard requires customFilter $autoFilter->getColumn('C') @@ -179,7 +179,7 @@ ); // Execute filtering -echo date('H:i:s').' Execute filtering'.EOL; +echo date('H:i:s'),' Execute filtering',EOL; $autoFilter->showHideRows(); // Set active sheet index to the first sheet, so Excel opens this as the first sheet @@ -187,7 +187,7 @@ // Display Results of filtering -echo date('H:i:s').' Display filtered rows'.EOL; +echo date('H:i:s'),' Display filtered rows',EOL; foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) { if ($objPHPExcel->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) { echo ' Row number - ' , $row->getRowIndex() , ' '; diff --git a/Examples/10autofilter.php b/Examples/10autofilter.php index ea3f76343..6fd2bdbd8 100644 --- a/Examples/10autofilter.php +++ b/Examples/10autofilter.php @@ -38,11 +38,11 @@ require_once dirname(__FILE__) . '/../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s').' Create new PHPExcel object'.EOL; +echo date('H:i:s'),' Create new PHPExcel object',EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s').' Set document properties'.EOL; +echo date('H:i:s'),' Set document properties',EOL; $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') ->setLastModifiedBy('Maarten Balliauw') ->setTitle('PHPExcel Test Document') @@ -52,7 +52,7 @@ ->setCategory('Test result file'); // Create the worksheet -echo date('H:i:s').' Add data'.EOL; +echo date('H:i:s'),' Add data',EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Year') ->setCellValue('B1', 'Quarter') @@ -119,11 +119,11 @@ $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A2'); // Set title row bold -echo date('H:i:s').' Set title row bold'.EOL; +echo date('H:i:s'),' Set title row bold',EOL; $objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getFont()->setBold(true); // Set autofilter -echo date('H:i:s').' Set autofilter'.EOL; +echo date('H:i:s'),' Set autofilter',EOL; // Always include the complete filter range! // Excel does support setting only the caption // row, but that's not a best practise... @@ -164,8 +164,8 @@ // Echo memory peak usage -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; +echo date('H:i:s'),' Peak memory usage: ',(memory_get_peak_usage(true) / 1024 / 1024),' MB',EOL; // Echo done -echo date('H:i:s').' Done writing files'.EOL; +echo date('H:i:s'),' Done writing files',EOL; echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Examples/13calculation.php b/Examples/13calculation.php index 01e63ea77..22bd8f63b 100644 --- a/Examples/13calculation.php +++ b/Examples/13calculation.php @@ -197,7 +197,7 @@ if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && ($formula[0] == '=')) { echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; + $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() , EOL; } } } diff --git a/Examples/18extendedcalculation.php b/Examples/18extendedcalculation.php index 3c6fcb492..13e27e7ce 100644 --- a/Examples/18extendedcalculation.php +++ b/Examples/18extendedcalculation.php @@ -40,16 +40,16 @@ // List functions -echo date('H:i:s') . " List implemented functions\n"; +echo date('H:i:s') , " List implemented functions\n"; $objCalc = PHPExcel_Calculation::getInstance(); print_r($objCalc->listFunctionNames()); // Create new PHPExcel object -echo date('H:i:s') . " Create new PHPExcel object\n"; +echo date('H:i:s') , " Create new PHPExcel object\n"; $objPHPExcel = new PHPExcel(); // Add some data, we will use some formulas here -echo date('H:i:s') . " Add some data\n"; +echo date('H:i:s') , " Add some data\n"; $objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:'); $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1'); @@ -97,12 +97,12 @@ $objPHPExcel->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)'); // Calculated data -echo date('H:i:s') . " Calculated data\n"; -echo 'Value of B14 [=COUNT(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B14')->getCalculatedValue() . "\r\n"; +echo date('H:i:s') , " Calculated data\n"; +echo 'Value of B14 [=COUNT(B2:B12)]: ' , $objPHPExcel->getActiveSheet()->getCell('B14')->getCalculatedValue() , "\r\n"; // Echo memory peak usage -echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n"; +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB\r\n"; // Echo done -echo date('H:i:s') . " Done" , EOL; +echo date('H:i:s') , " Done" , EOL; diff --git a/Examples/26utf8.php b/Examples/26utf8.php index ad0b40059..ea9e5f2c9 100644 --- a/Examples/26utf8.php +++ b/Examples/26utf8.php @@ -81,12 +81,12 @@ $rendererName, $rendererLibraryPath )) { - echo ( - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - EOL . - 'at the top of this script as appropriate for your directory structure' . + echo + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' , + EOL , + 'at the top of this script as appropriate for your directory structure' , EOL - ); + ; } else { $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF'); $objWriter->save(str_replace('.php', '.pdf', __FILE__)); diff --git a/Examples/31docproperties_write-xls.php b/Examples/31docproperties_write-xls.php index cbb9aa352..0f28ef40d 100644 --- a/Examples/31docproperties_write-xls.php +++ b/Examples/31docproperties_write-xls.php @@ -70,7 +70,7 @@ // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; echo EOL; @@ -116,4 +116,4 @@ } // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; diff --git a/Examples/31docproperties_write.php b/Examples/31docproperties_write.php index 1b01f6fe0..e1a0f32f4 100644 --- a/Examples/31docproperties_write.php +++ b/Examples/31docproperties_write.php @@ -70,7 +70,7 @@ // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; echo EOL; @@ -116,4 +116,4 @@ } // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; +echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; diff --git a/Examples/40duplicateStyle.php b/Examples/40duplicateStyle.php index be31951a4..407df717a 100644 --- a/Examples/40duplicateStyle.php +++ b/Examples/40duplicateStyle.php @@ -36,7 +36,7 @@ } } $d = microtime(true) - $t; -echo date('H:i:s') , " Add data (end), time: " . round($d, 2) . " s", EOL; +echo date('H:i:s') , " Add data (end), time: " , round($d, 2) , " s", EOL; echo date('H:i:s') , " Write to Excel2007 format" , EOL; diff --git a/Examples/Quadratic.php b/Examples/Quadratic.php index 11a712e5d..f1c4757cd 100644 --- a/Examples/Quadratic.php +++ b/Examples/Quadratic.php @@ -52,13 +52,13 @@ echo '
Roots:
'; $callStartTime = microtime(true); - echo $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue().'
'; - echo $objPHPExcel->getActiveSheet()->getCell('B6')->getCalculatedValue().'
'; + echo $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue(),'
'; + echo $objPHPExcel->getActiveSheet()->getCell('B6')->getCalculatedValue(),'
'; $callEndTime = microtime(true); $callTime = $callEndTime - $callStartTime; - echo '
Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds

'; - echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB
'; + echo '
Call time for Quadratic Equation Solution was ',sprintf('%.4f',$callTime),' seconds

'; + echo ' Peak memory usage: ',(memory_get_peak_usage(true) / 1024 / 1024),' MB
'; } } diff --git a/Examples/Quadratic2.php b/Examples/Quadratic2.php index 5f6013eab..ec73e0416 100644 --- a/Examples/Quadratic2.php +++ b/Examples/Quadratic2.php @@ -49,13 +49,13 @@ $r1Formula = '=IMDIV(IMSUM(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].')'; $r2Formula = '=IF('.$discriminant.'=0,"Only one root",IMDIV(IMSUB(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].'))'; - echo PHPExcel_Calculation::getInstance()->calculateFormula($r1Formula).'
'; - echo PHPExcel_Calculation::getInstance()->calculateFormula($r2Formula).'
'; + echo PHPExcel_Calculation::getInstance()->calculateFormula($r1Formula),'
'; + echo PHPExcel_Calculation::getInstance()->calculateFormula($r2Formula),'
'; $callEndTime = microtime(true); $callTime = $callEndTime - $callStartTime; - echo '
Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds

'; - echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB
'; + echo '
Call time for Quadratic Equation Solution was ',sprintf('%.4f',$callTime),' seconds

'; + echo ' Peak memory usage: ',(memory_get_peak_usage(true) / 1024 / 1024),' MB
'; } } diff --git a/Examples/runall.php b/Examples/runall.php index b2af1ccd0..500fae8e5 100644 --- a/Examples/runall.php +++ b/Examples/runall.php @@ -121,8 +121,8 @@ // Run all tests foreach ($aTests as $sTest) { - echo '============== TEST ==============' . "\r\n"; - echo 'Test name: ' . $sTest . "\r\n"; + echo '============== TEST ==============' , "\r\n"; + echo 'Test name: ' , $sTest , "\r\n"; echo "\r\n"; echo shell_exec('php ' . $sTest); echo "\r\n"; diff --git a/unitTests/bootstrap.php b/unitTests/bootstrap.php index 8e8cdb39a..a421b6a50 100644 --- a/unitTests/bootstrap.php +++ b/unitTests/bootstrap.php @@ -45,5 +45,5 @@ echo "Xdebug extension loaded and running\n"; xdebug_enable(); } else { - echo 'Xdebug not found, you should run the following at the command line: echo "zend_extension=/usr/lib64/php/modules/xdebug.so" > /etc/php.d/xdebug.ini' . "\n"; + echo 'Xdebug not found, you should run the following at the command line: echo "zend_extension=/usr/lib64/php/modules/xdebug.so" > /etc/php.d/xdebug.ini' , "\n"; }