diff --git a/Classes/PHPExcel/Reader/HTML.php b/Classes/PHPExcel/Reader/HTML.php index dafc7c5..5299481 100644 --- a/Classes/PHPExcel/Reader/HTML.php +++ b/Classes/PHPExcel/Reader/HTML.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2011 PHPExcel + * Copyright (c) 2006 - 2012 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ @@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader { diff --git a/Tests/01simple-download-pdf.php b/Tests/01simple-download-pdf.php index dccbcd0..5fe4a84 100644 --- a/Tests/01simple-download-pdf.php +++ b/Tests/01simple-download-pdf.php @@ -27,9 +27,13 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +if (PHP_SAPI == 'cli') + die('This example should only be run from a Web Browser'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; @@ -84,7 +88,7 @@ if (!PHPExcel_Settings::setPdfRenderer( )) { die( 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . - PHP_EOL . + '
' . 'at the top of this script as appropriate for your directory structure' ); } diff --git a/Tests/01simple-download-xls.php b/Tests/01simple-download-xls.php index f6b6064..c1d670d 100644 --- a/Tests/01simple-download-xls.php +++ b/Tests/01simple-download-xls.php @@ -27,9 +27,13 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +if (PHP_SAPI == 'cli') + die('This example should only be run from a Web Browser'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; diff --git a/Tests/01simple-download-xlsx.php b/Tests/01simple-download-xlsx.php index 5accf27..fd98a9f 100644 --- a/Tests/01simple-download-xlsx.php +++ b/Tests/01simple-download-xlsx.php @@ -27,9 +27,13 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +if (PHP_SAPI == 'cli') + die('This example should only be run from a Web Browser'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; diff --git a/Tests/01simple.php b/Tests/01simple.php index c89352d..eff79bd 100644 --- a/Tests/01simple.php +++ b/Tests/01simple.php @@ -27,19 +27,22 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("PHPExcel Test Document") @@ -50,7 +53,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Add some data -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A1', 'Hello') ->setCellValue('B2', 'world!') @@ -63,7 +66,7 @@ $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Simple'); @@ -72,19 +75,20 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Save Excel5 file -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel5 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing files" , EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/02types-xls.php b/Tests/02types-xls.php index b524998..ba84d6a 100644 --- a/Tests/02types-xls.php +++ b/Tests/02types-xls.php @@ -27,19 +27,22 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -49,65 +52,65 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setCategory("Test result file"); // Set default font -echo date('H:i:s') , " Set default font" , PHP_EOL; -$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial'); -$objPHPExcel->getDefaultStyle()->getFont()->setSize(10); +echo date('H:i:s') , " Set default font" , EOL; +$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial') + ->setSize(10); // Add some data, resembling some different data types -echo date('H:i:s') , " Add some data" , PHP_EOL; -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Simple'); -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'PHPExcel'); +echo date('H:i:s') , " Add some data" , EOL; +$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String') + ->setCellValue('B1', 'Simple') + ->setCellValue('C1', 'PHPExcel'); -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Symbols'); -$objPHPExcel->getActiveSheet()->setCellValue('C2', '!+&=()~§±æþ'); +$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String') + ->setCellValue('B2', 'Symbols') + ->setCellValue('C2', '!+&=()~§±æþ'); -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B3', 'UTF-8'); -$objPHPExcel->getActiveSheet()->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); +$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String') + ->setCellValue('B3', 'UTF-8') + ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); -$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B4', 'Integer'); -$objPHPExcel->getActiveSheet()->setCellValue('C4', 12); +$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number') + ->setCellValue('B4', 'Integer') + ->setCellValue('C4', 12); -$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B5', 'Float'); -$objPHPExcel->getActiveSheet()->setCellValue('C5', 34.56); +$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number') + ->setCellValue('B5', 'Float') + ->setCellValue('C5', 34.56); -$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B6', 'Negative'); -$objPHPExcel->getActiveSheet()->setCellValue('C6', -7.89); +$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number') + ->setCellValue('B6', 'Negative') + ->setCellValue('C6', -7.89); -$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean'); -$objPHPExcel->getActiveSheet()->setCellValue('B7', 'True'); -$objPHPExcel->getActiveSheet()->setCellValue('C7', true); +$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean') + ->setCellValue('B7', 'True') + ->setCellValue('C7', true); -$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean'); -$objPHPExcel->getActiveSheet()->setCellValue('B8', 'False'); -$objPHPExcel->getActiveSheet()->setCellValue('C8', false); +$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean') + ->setCellValue('B8', 'False') + ->setCellValue('C8', false); $dateTimeNow = time(); -$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B9', 'Date'); -$objPHPExcel->getActiveSheet()->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time') + ->setCellValue('B9', 'Date') + ->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2); -$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B10', 'Time'); -$objPHPExcel->getActiveSheet()->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time') + ->setCellValue('B10', 'Time') + ->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4); -$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B11', 'Date and Time'); -$objPHPExcel->getActiveSheet()->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time') + ->setCellValue('B11', 'Date and Time') + ->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Datatypes'); @@ -116,20 +119,21 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel5 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo date('H:i:s') , " Reload workbook from saved file" , PHP_EOL; +echo date('H:i:s') , " Reload workbook from saved file" , EOL; $objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__)); var_dump($objPHPExcel->getActiveSheet()->toArray()); // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/02types.php b/Tests/02types.php index a6a3136..fcfd677 100644 --- a/Tests/02types.php +++ b/Tests/02types.php @@ -27,19 +27,22 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -49,65 +52,65 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setCategory("Test result file"); // Set default font -echo date('H:i:s') , " Set default font" , PHP_EOL; -$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial'); -$objPHPExcel->getDefaultStyle()->getFont()->setSize(10); +echo date('H:i:s') , " Set default font" , EOL; +$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial') + ->setSize(10); // Add some data, resembling some different data types -echo date('H:i:s') , " Add some data" , PHP_EOL; -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Simple'); -$objPHPExcel->getActiveSheet()->setCellValue('C1', 'PHPExcel'); +echo date('H:i:s') , " Add some data" , EOL; +$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String') + ->setCellValue('B1', 'Simple') + ->setCellValue('C1', 'PHPExcel'); -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Symbols'); -$objPHPExcel->getActiveSheet()->setCellValue('C2', '!+&=()~§±æþ'); +$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String') + ->setCellValue('B2', 'Symbols') + ->setCellValue('C2', '!+&=()~§±æþ'); -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String'); -$objPHPExcel->getActiveSheet()->setCellValue('B3', 'UTF-8'); -$objPHPExcel->getActiveSheet()->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); +$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String') + ->setCellValue('B3', 'UTF-8') + ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); -$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B4', 'Integer'); -$objPHPExcel->getActiveSheet()->setCellValue('C4', 12); +$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number') + ->setCellValue('B4', 'Integer') + ->setCellValue('C4', 12); -$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B5', 'Float'); -$objPHPExcel->getActiveSheet()->setCellValue('C5', 34.56); +$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number') + ->setCellValue('B5', 'Float') + ->setCellValue('C5', 34.56); -$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number'); -$objPHPExcel->getActiveSheet()->setCellValue('B6', 'Negative'); -$objPHPExcel->getActiveSheet()->setCellValue('C6', -7.89); +$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number') + ->setCellValue('B6', 'Negative') + ->setCellValue('C6', -7.89); -$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean'); -$objPHPExcel->getActiveSheet()->setCellValue('B7', 'True'); -$objPHPExcel->getActiveSheet()->setCellValue('C7', true); +$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean') + ->setCellValue('B7', 'True') + ->setCellValue('C7', true); -$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean'); -$objPHPExcel->getActiveSheet()->setCellValue('B8', 'False'); -$objPHPExcel->getActiveSheet()->setCellValue('C8', false); +$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean') + ->setCellValue('B8', 'False') + ->setCellValue('C8', false); $dateTimeNow = time(); -$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B9', 'Date'); -$objPHPExcel->getActiveSheet()->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time') + ->setCellValue('B9', 'Date') + ->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2); -$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B10', 'Time'); -$objPHPExcel->getActiveSheet()->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time') + ->setCellValue('B10', 'Time') + ->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4); -$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time'); -$objPHPExcel->getActiveSheet()->setCellValue('B11', 'Date and Time'); -$objPHPExcel->getActiveSheet()->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); +$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time') + ->setCellValue('B11', 'Date and Time') + ->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow )); $objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Datatypes'); @@ -116,20 +119,21 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; -echo date('H:i:s') , " Reload workbook from saved file" , PHP_EOL; +echo date('H:i:s') , " Reload workbook from saved file" , EOL; $objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xlsx', __FILE__)); var_dump($objPHPExcel->getActiveSheet()->toArray()); // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/03formulas.php b/Tests/03formulas.php index 9726084..64712c8 100644 --- a/Tests/03formulas.php +++ b/Tests/03formulas.php @@ -27,19 +27,22 @@ /** Error reporting */ error_reporting(E_ALL); - +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,7 +53,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Add some data, we will use some formulas here -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Sum:'); $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range #1') @@ -59,7 +62,7 @@ $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range #1') ->setCellValue('B4', 13) ->setCellValue('B5', '=SUM(B2:B4)'); echo date('H:i:s') , " Sum of Range #1 is " , - $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , EOL; $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range #2') ->setCellValue('C2', 5) @@ -67,31 +70,31 @@ $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range #2') ->setCellValue('C4', 17) ->setCellValue('C5', '=SUM(C2:C4)'); echo date('H:i:s') , " Sum of Range #2 is " , - $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , EOL; $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total of both ranges:'); $objPHPExcel->getActiveSheet()->setCellValue('B7', '=SUM(B5:C5)'); echo date('H:i:s') , " Sum of both Ranges is " , - $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , EOL; $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Minimum of both ranges:'); $objPHPExcel->getActiveSheet()->setCellValue('B8', '=MIN(B2:C4)'); echo date('H:i:s') , " Minimum value in either Range is " , - $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , EOL; $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Maximum of both ranges:'); $objPHPExcel->getActiveSheet()->setCellValue('B9', '=MAX(B2:C4)'); echo date('H:i:s') , " Maximum value in either Range is " , - $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , EOL; $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Average of both ranges:'); $objPHPExcel->getActiveSheet()->setCellValue('B10', '=AVERAGE(B2:C4)'); echo date('H:i:s') , " Average value of both Ranges is " , - $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , PHP_EOL; + $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , EOL; // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Formulas'); @@ -100,14 +103,20 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; +// Save Excel5 file +echo date('H:i:s') , " Write to Excel5 format" , EOL; +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); +$objWriter->save(str_replace('.php', '.xls', __FILE__)); +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing files" , EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/04printing.php b/Tests/04printing.php index 4375d05..2e8c0f0 100644 --- a/Tests/04printing.php +++ b/Tests/04printing.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -35,11 +39,11 @@ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,19 +54,19 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Add some data, we will use printing features -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; for ($i = 1; $i < 200; $i++) { $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $i); $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, 'Test value'); } // Set header and footer. When no different headers for odd/even are used, odd header is assumed. -echo date('H:i:s') , " Set header/footer" , PHP_EOL; +echo date('H:i:s') , " Set header/footer" , EOL; $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N'); // Add a drawing to the header -echo date('H:i:s') , " Add a drawing to the header" , PHP_EOL; +echo date('H:i:s') , " Add a drawing to the header" , EOL; $objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing(); $objDrawing->setName('PHPExcel logo'); $objDrawing->setPath('./images/phpexcel_logo.gif'); @@ -70,12 +74,12 @@ $objDrawing->setHeight(36); $objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT); // Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , PHP_EOL; +echo date('H:i:s') , " Set page orientation and size" , EOL; $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Printing'); @@ -84,14 +88,20 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; +// Save Excel5 file +echo date('H:i:s') , " Write to Excel5 format" , EOL; +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); +$objWriter->save(str_replace('.php', '.xls', __FILE__)); +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing files" , EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/05featuredemo.php b/Tests/05featuredemo.php index 99759c9..69f16c9 100644 --- a/Tests/05featuredemo.php +++ b/Tests/05featuredemo.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -37,13 +41,19 @@ require_once '../Classes/PHPExcel/IOFactory.php'; // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; +// Save Excel5 file +echo date('H:i:s') , " Write to Excel5 format" , EOL; +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); +$objWriter->save(str_replace('.php', '.xls', __FILE__)); +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing files" , EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/06largescale-xls.php b/Tests/06largescale-xls.php index 366fbc7..551fab4 100644 --- a/Tests/06largescale-xls.php +++ b/Tests/06largescale-xls.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -49,11 +53,11 @@ for writing to Excel2007: */ // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_EOL; +echo date('H:i:s') , " Create new PHPExcel object" , EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s') , " Set properties" , PHP_EOL; +echo date('H:i:s') , " Set properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -64,7 +68,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Create a first sheet -echo date('H:i:s') , " Add data" , PHP_EOL; +echo date('H:i:s') , " Add data" , EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); $objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); @@ -74,24 +78,24 @@ $objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); // Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , PHP_EOL; +echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); // Set outline levels -echo date('H:i:s') , " Set outline levels" , PHP_EOL; +echo date('H:i:s') , " Set outline levels" , EOL; $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) ->setVisible(false) ->setCollapsed(true); // Freeze panes -echo date('H:i:s') , " Freeze panes" , PHP_EOL; +echo date('H:i:s') , " Freeze panes" , EOL; $objPHPExcel->getActiveSheet()->freezePane('A2'); // Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , PHP_EOL; +echo date('H:i:s') , " Rows to repeat at top" , EOL; $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); @@ -110,14 +114,15 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 5 file -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel5 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/06largescale.php b/Tests/06largescale.php index 20eb409..0a6377f 100644 --- a/Tests/06largescale.php +++ b/Tests/06largescale.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -49,11 +53,11 @@ for writing to Excel2007: */ // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_EOL; +echo date('H:i:s') , " Create new PHPExcel object" , EOL; $objPHPExcel = new PHPExcel(); // Set document properties -echo date('H:i:s') , " Set properties" , PHP_EOL; +echo date('H:i:s') , " Set properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -64,7 +68,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Create a first sheet -echo date('H:i:s') , " Add data" , PHP_EOL; +echo date('H:i:s') , " Add data" , EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname"); $objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname"); @@ -74,24 +78,24 @@ $objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?"); // Hide "Phone" and "fax" column -echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , PHP_EOL; +echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL; $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false); // Set outline levels -echo date('H:i:s') , " Set outline levels" , PHP_EOL; +echo date('H:i:s') , " Set outline levels" , EOL; $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1) ->setVisible(false) ->setCollapsed(true); // Freeze panes -echo date('H:i:s') , " Freeze panes" , PHP_EOL; +echo date('H:i:s') , " Freeze panes" , EOL; $objPHPExcel->getActiveSheet()->freezePane('A2'); // Rows to repeat at top -echo date('H:i:s') , " Rows to repeat at top" , PHP_EOL; +echo date('H:i:s') , " Rows to repeat at top" , EOL; $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1); @@ -110,14 +114,15 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/07reader.php b/Tests/07reader.php index 5b14b94..649382f 100644 --- a/Tests/07reader.php +++ b/Tests/07reader.php @@ -26,6 +26,10 @@ */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -34,20 +38,21 @@ require_once '../Classes/PHPExcel/IOFactory.php'; if (!file_exists("05featuredemo.xlsx")) { - exit("Please run 05featuredemo.php first." . PHP_EOL); + exit("Please run 05featuredemo.php first." . EOL); } -echo date('H:i:s') , " Load from Excel2007 file" , PHP_EOL; +echo date('H:i:s') , " Load from Excel2007 file" , EOL; $objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx"); -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/08conditionalformatting.php b/Tests/08conditionalformatting.php index 274c53f..36f4ec8 100644 --- a/Tests/08conditionalformatting.php +++ b/Tests/08conditionalformatting.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -35,11 +39,11 @@ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,59 +54,59 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Create a first sheet, representing sales data -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; $objPHPExcel->setActiveSheetIndex(0); -$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Description'); -$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Amount'); +$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Description') + ->setCellValue('B1', 'Amount'); -$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Paycheck received'); -$objPHPExcel->getActiveSheet()->setCellValue('B2', 100); +$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Paycheck received') + ->setCellValue('B2', 100); -$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought'); -$objPHPExcel->getActiveSheet()->setCellValue('B3', -1.5); +$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought') + ->setCellValue('B3', -1.5); -$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought'); -$objPHPExcel->getActiveSheet()->setCellValue('B4', -1.5); +$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought') + ->setCellValue('B4', -1.5); -$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Cup of tea bought'); -$objPHPExcel->getActiveSheet()->setCellValue('B5', -1.2); +$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Cup of tea bought') + ->setCellValue('B5', -1.2); -$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Found some money'); -$objPHPExcel->getActiveSheet()->setCellValue('B6', 8); +$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Found some money') + ->setCellValue('B6', 8); -$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total:'); -$objPHPExcel->getActiveSheet()->setCellValue('B7', '=SUM(B2:B6)'); +$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total:') + ->setCellValue('B7', '=SUM(B2:B6)'); // Set column widths -echo date('H:i:s') , " Set column widths" , PHP_EOL; +echo date('H:i:s') , " Set column widths" , EOL; $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12); // Add conditional formatting -echo date('H:i:s') , " Add conditional formatting" , PHP_EOL; +echo date('H:i:s') , " Add conditional formatting" , EOL; $objConditional1 = new PHPExcel_Style_Conditional(); -$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS); -$objConditional1->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN); -$objConditional1->addCondition('200'); -$objConditional1->addCondition('400'); +$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS) + ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN) + ->addCondition('200') + ->addCondition('400'); $objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW); $objConditional1->getStyle()->getFont()->setBold(true); $objConditional1->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); $objConditional2 = new PHPExcel_Style_Conditional(); -$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS); -$objConditional2->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN); -$objConditional2->addCondition('0'); +$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS) + ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN) + ->addCondition('0'); $objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED); $objConditional2->getStyle()->getFont()->setBold(true); $objConditional2->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); $objConditional3 = new PHPExcel_Style_Conditional(); -$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS); -$objConditional3->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL); -$objConditional3->addCondition('0'); +$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS) + ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL) + ->addCondition('0'); $objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN); $objConditional3->getStyle()->getFont()->setBold(true); $objConditional3->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); @@ -115,15 +119,15 @@ $objPHPExcel->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditiona // duplicate the conditional styles across a range of cells -echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , PHP_EOL; +echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL; $objPHPExcel->getActiveSheet()->duplicateConditionalStyle( $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(), 'B3:B7' - ); + ); // Set fonts -echo date('H:i:s') , " Set fonts" , PHP_EOL; +echo date('H:i:s') , " Set fonts" , EOL; $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A7')->getFont()->setBold(true); @@ -131,19 +135,19 @@ $objPHPExcel->getActiveSheet()->getStyle('B7')->getFont()->setBold(true); // Set header and footer. When no different headers for odd/even are used, odd header is assumed. -echo date('H:i:s') , " Set header/footer" , PHP_EOL; +echo date('H:i:s') , " Set header/footer" , EOL; $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D'); $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N'); // Set page orientation and size -echo date('H:i:s') , " Set page orientation and size" , PHP_EOL; +echo date('H:i:s') , " Set page orientation and size" , EOL; $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Invoice'); @@ -152,14 +156,15 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/09pagebreaks.php b/Tests/09pagebreaks.php index 3fb7d7b..1437ef5 100644 --- a/Tests/09pagebreaks.php +++ b/Tests/09pagebreaks.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -35,11 +39,11 @@ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,7 +54,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Create a first sheet -echo date('H:i:s') , " Add data and page breaks" , PHP_EOL; +echo date('H:i:s') , " Add data and page breaks" , EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname") ->setCellValue('B1', "Lastname") @@ -80,14 +84,20 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; +// Save Excel5 file +echo date('H:i:s') , " Write to Excel5 format" , EOL; +$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); +$objWriter->save(str_replace('.php', '.xls', __FILE__)); +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing files" , EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/10autofilter.php b/Tests/10autofilter.php index 68cf3bf..4caf7a2 100644 --- a/Tests/10autofilter.php +++ b/Tests/10autofilter.php @@ -27,19 +27,16 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; -if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { - define('EOL',PHP_EOL); -} -else { - define('EOL', '
'); -} - // Create new PHPExcel object echo date('H:i:s').' Create new PHPExcel object'.EOL; $objPHPExcel = new PHPExcel(); @@ -139,15 +136,16 @@ $objPHPExcel->setActiveSheetIndex(0); echo date('H:i:s').' Write to Excel2007 format'.EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s').' File written to '.str_replace('.php', '.xlsx', __FILE__).EOL; +echo date('H:i:s').' File written to '.str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)).EOL; // Save Excel5 file echo date('H:i:s').' Write to Excel5 format'.EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s').' File written to '.str_replace('.php', '.xls', __FILE__).EOL; +echo date('H:i:s').' File written to '.str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)).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 date('H:i:s').' Done writing files'.EOL; +echo 'Files have been created in ' , getcwd() , EOL; diff --git a/Tests/11documentsecurity-xls.php b/Tests/11documentsecurity-xls.php index 71a60f0..26f36a8 100644 --- a/Tests/11documentsecurity-xls.php +++ b/Tests/11documentsecurity-xls.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -35,11 +39,11 @@ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,7 +54,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Add some data -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello'); $objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!'); @@ -58,19 +62,19 @@ $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello'); $objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!'); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set document security -echo date('H:i:s') , " Set document security" , PHP_EOL; +echo date('H:i:s') , " Set document security" , EOL; $objPHPExcel->getSecurity()->setLockWindows(true); $objPHPExcel->getSecurity()->setLockStructure(true); $objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel"); // Set sheet security -echo date('H:i:s') , " Set sheet security" , PHP_EOL; +echo date('H:i:s') , " Set sheet security" , EOL; $objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel'); $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! $objPHPExcel->getActiveSheet()->getProtection()->setSort(true); @@ -83,14 +87,15 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel5 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/11documentsecurity.php b/Tests/11documentsecurity.php index 6646710..c6a8ab2 100644 --- a/Tests/11documentsecurity.php +++ b/Tests/11documentsecurity.php @@ -27,6 +27,10 @@ /** Error reporting */ error_reporting(E_ALL); +ini_set('display_errors', TRUE); +ini_set('display_startup_errors', TRUE); + +define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); @@ -35,11 +39,11 @@ require_once '../Classes/PHPExcel.php'; // Create new PHPExcel object -echo date('H:i:s') , " Create new PHPExcel object" , PHP_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" , PHP_EOL; +echo date('H:i:s') , " Set document properties" , EOL; $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") @@ -50,7 +54,7 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") // Add some data -echo date('H:i:s') , " Add some data" , PHP_EOL; +echo date('H:i:s') , " Add some data" , EOL; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello'); $objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!'); @@ -58,19 +62,19 @@ $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello'); $objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!'); // Rename worksheet -echo date('H:i:s') , " Rename worksheet" , PHP_EOL; +echo date('H:i:s') , " Rename worksheet" , EOL; $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set document security -echo date('H:i:s') , " Set document security" , PHP_EOL; +echo date('H:i:s') , " Set document security" , EOL; $objPHPExcel->getSecurity()->setLockWindows(true); $objPHPExcel->getSecurity()->setLockStructure(true); $objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel"); // Set sheet security -echo date('H:i:s') , " Set sheet security" , PHP_EOL; +echo date('H:i:s') , " Set sheet security" , EOL; $objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel'); $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! $objPHPExcel->getActiveSheet()->getProtection()->setSort(true); @@ -83,14 +87,15 @@ $objPHPExcel->setActiveSheetIndex(0); // Save Excel 2007 file -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; +echo date('H:i:s') , " Write to Excel2007 format" , EOL; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; +echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; // Echo memory peak usage -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_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 file" , PHP_EOL; +echo date('H:i:s') , " Done writing file" , EOL; +echo 'File has been created in ' , getcwd() , EOL; diff --git a/Tests/18extendedcalculation.php b/Tests/18extendedcalculation.php index fd94860..954e589 100644 --- a/Tests/18extendedcalculation.php +++ b/Tests/18extendedcalculation.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (C) 2006 - 2011 PHPExcel + * Copyright (C) 2006 - 2012 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ @@ -46,28 +46,6 @@ $objPHPExcel = new PHPExcel(); // Add some data, we will use some formulas here echo date('H:i:s') . " Add some data\n"; $objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:'); -$objPHPExcel->getActiveSheet()->setCellValue('A15', 'Sum:'); -$objPHPExcel->getActiveSheet()->setCellValue('A16', 'Max:'); -$objPHPExcel->getActiveSheet()->setCellValue('A17', 'Min:'); -$objPHPExcel->getActiveSheet()->setCellValue('A18', 'Average:'); -$objPHPExcel->getActiveSheet()->setCellValue('A19', 'Median:'); -$objPHPExcel->getActiveSheet()->setCellValue('A20', 'Mode:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A22', 'CountA:'); -$objPHPExcel->getActiveSheet()->setCellValue('A23', 'MaxA:'); -$objPHPExcel->getActiveSheet()->setCellValue('A24', 'MinA:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A26', 'StDev:'); -$objPHPExcel->getActiveSheet()->setCellValue('A27', 'StDevA:'); -$objPHPExcel->getActiveSheet()->setCellValue('A28', 'StDevP:'); -$objPHPExcel->getActiveSheet()->setCellValue('A29', 'StDevPA:'); - -$objPHPExcel->getActiveSheet()->setCellValue('A31', 'DevSq:'); -$objPHPExcel->getActiveSheet()->setCellValue('A32', 'Var:'); -$objPHPExcel->getActiveSheet()->setCellValue('A33', 'VarA:'); -$objPHPExcel->getActiveSheet()->setCellValue('A34', 'VarP:'); -$objPHPExcel->getActiveSheet()->setCellValue('A35', 'VarPA:'); - $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1'); $objPHPExcel->getActiveSheet()->setCellValue('B2', 2); @@ -82,27 +60,6 @@ $objPHPExcel->getActiveSheet()->setCellValue('B11', 6); $objPHPExcel->getActiveSheet()->setCellValue('B12', 12); $objPHPExcel->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B15', '=SUM(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B16', '=MAX(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B17', '=MIN(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B18', '=AVERAGE(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B19', '=MEDIAN(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B20', '=MODE(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B22', '=COUNTA(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B23', '=MAXA(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B24', '=MINA(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B26', '=STDEV(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B27', '=STDEVA(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B28', '=STDEVP(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B29', '=STDEVPA(B2:B12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('B31', '=DEVSQ(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B32', '=VAR(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B33', '=VARA(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B34', '=VARP(B2:B12)'); -$objPHPExcel->getActiveSheet()->setCellValue('B35', '=VARPA(B2:B12)'); $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range 2'); $objPHPExcel->getActiveSheet()->setCellValue('C2', 1); @@ -118,28 +75,6 @@ $objPHPExcel->getActiveSheet()->setCellValue('C11', 4); $objPHPExcel->getActiveSheet()->setCellValue('C12', 4); $objPHPExcel->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C15', '=SUM(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C16', '=MAX(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C17', '=MIN(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C18', '=AVERAGE(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C19', '=MEDIAN(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C20', '=MODE(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C22', '=COUNTA(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C23', '=MAXA(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C24', '=MINA(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C26', '=STDEV(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C27', '=STDEVA(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C28', '=STDEVP(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C29', '=STDEVPA(C2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('C31', '=DEVSQ(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C32', '=VAR(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C33', '=VARA(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C34', '=VARP(C2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('C35', '=VARPA(C2:C12)'); - $objPHPExcel->getActiveSheet()->setCellValue('D1', 'Range 3'); $objPHPExcel->getActiveSheet()->setCellValue('D2', 2); @@ -156,72 +91,9 @@ $objPHPExcel->getActiveSheet()->setCellValue('E4', '=RANDBETWEEN(5, 10)'); $objPHPExcel->getActiveSheet()->setCellValue('E14', 'Count of both ranges:'); $objPHPExcel->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)'); -$objPHPExcel->getActiveSheet()->setCellValue('E15', 'Total of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F15', '=SUM(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E16', 'Maximum of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F16', '=MAX(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E17', 'Minimum of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F17', '=MIN(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E18', 'Average of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F18', '=AVERAGE(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E19', 'Median of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F19', '=MEDIAN(B2:C12)'); - -$objPHPExcel->getActiveSheet()->setCellValue('E20', 'Mode of both ranges:'); -$objPHPExcel->getActiveSheet()->setCellValue('F20', '=MODE(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 'Value of B15 [=SUM(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B15')->getCalculatedValue() . "\r\n"; -echo 'Value of B16 [=MAX(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B16')->getCalculatedValue() . "\r\n"; -echo 'Value of B17 [=MIN(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B17')->getCalculatedValue() . "\r\n"; -echo 'Value of B18 [=AVERAGE(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B18')->getCalculatedValue() . "\r\n"; -echo 'Value of B19 [=MEDIAN(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B19')->getCalculatedValue() . "\r\n"; -echo 'Value of B20 [=MODE(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B20')->getCalculatedValue() . "\r\n"; - -echo 'Value of B22 [=COUNTA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B22')->getCalculatedValue() . "\r\n"; -echo 'Value of B23 [=MAXA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B23')->getCalculatedValue() . "\r\n"; -echo 'Value of B24 [=MINA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B24')->getCalculatedValue() . "\r\n"; - -echo 'Value of B26 [=STDEV(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B26')->getCalculatedValue() . "\r\n"; -echo 'Value of B27 [=STDEVA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B27')->getCalculatedValue() . "\r\n"; -echo 'Value of B28 [=STDEVP(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B28')->getCalculatedValue() . "\r\n"; -echo 'Value of B29 [=STDEVPA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B29')->getCalculatedValue() . "\r\n"; - -echo 'Value of B31 [=DEVSQ(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B31')->getCalculatedValue() . "\r\n"; -echo 'Value of B32 [=VAR(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B32')->getCalculatedValue() . "\r\n"; -echo 'Value of B33 [=VARA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B33')->getCalculatedValue() . "\r\n"; -echo 'Value of B34 [=VARP(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B34')->getCalculatedValue() . "\r\n"; -echo 'Value of B35 [=VARPA(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B35')->getCalculatedValue() . "\r\n"; - -echo 'Value of C14 [=COUNT(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C14')->getCalculatedValue() . "\r\n"; -echo 'Value of C15 [=SUM(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C15')->getCalculatedValue() . "\r\n"; -echo 'Value of C16 [=MAX(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C16')->getCalculatedValue() . "\r\n"; -echo 'Value of C17 [=MIN(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C17')->getCalculatedValue() . "\r\n"; -echo 'Value of C18 [=AVERAGE(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C18')->getCalculatedValue() . "\r\n"; -echo 'Value of C19 [=MEDIAN(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C19')->getCalculatedValue() . "\r\n"; -echo 'Value of C20 [=MODE(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C20')->getCalculatedValue() . "\r\n"; - -echo 'Value of C22 [=COUNTA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C22')->getCalculatedValue() . "\r\n"; -echo 'Value of C23 [=MAXA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C23')->getCalculatedValue() . "\r\n"; -echo 'Value of C24 [=MINA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C24')->getCalculatedValue() . "\r\n"; - -echo 'Value of C26 [=STDEV(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C26')->getCalculatedValue() . "\r\n"; -echo 'Value of C27 [=STDEVA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C27')->getCalculatedValue() . "\r\n"; -echo 'Value of C28 [=STDEVP(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C28')->getCalculatedValue() . "\r\n"; -echo 'Value of C29 [=STDEVPA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C29')->getCalculatedValue() . "\r\n"; - -echo 'Value of C31 [=DEVSQ(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C31')->getCalculatedValue() . "\r\n"; -echo 'Value of C32 [=VAR(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C32')->getCalculatedValue() . "\r\n"; -echo 'Value of C33 [=VARA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C33')->getCalculatedValue() . "\r\n"; -echo 'Value of C34 [=VARP(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C34')->getCalculatedValue() . "\r\n"; -echo 'Value of C35 [=VARPA(C2:C12)]: ' . $objPHPExcel->getActiveSheet()->getCell('C35')->getCalculatedValue() . "\r\n"; // Echo memory peak usage diff --git a/install.txt b/install.txt index c19f944..79cd815 100644 --- a/install.txt +++ b/install.txt @@ -17,7 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * -* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## ************************************************************************************** diff --git a/unitTests/bootstrap.php b/unitTests/bootstrap.php index 61ae205..a502c17 100644 --- a/unitTests/bootstrap.php +++ b/unitTests/bootstrap.php @@ -2,7 +2,7 @@ /** * $Id: bootstrap.php 2892 2011-08-14 15:11:50Z markbaker@phpexcel.net $ * - * @copyright Copyright (C) 2011 PHPExcel. All rights reserved. + * @copyright Copyright (C) 2011-2012 PHPExcel. All rights reserved. * @package PHPExcel * @subpackage PHPExcel Unit Tests * @author Mark Baker