Fix some errors with samples
This commit is contained in:
parent
114fc00763
commit
6e222bbdde
|
@ -39,7 +39,7 @@ require_once '../Build/PHPExcel.phar';
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -78,7 +78,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -93,7 +93,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
|
||||||
die('This example should only be run from a Web Browser');
|
die('This example should only be run from a Web Browser');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
|
@ -84,6 +84,6 @@ header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||||
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header ('Pragma: public'); // HTTP/1.0
|
header ('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'OpenDocument');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'OpenDocument');
|
||||||
$objWriter->save('php://output');
|
$objWriter->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -35,14 +35,14 @@ if (PHP_SAPI == 'cli')
|
||||||
die('This example should only be run from a Web Browser');
|
die('This example should only be run from a Web Browser');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = PHPExcel\Settings::PDF_RENDERER_TCPDF;
|
||||||
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
|
$rendererName = PHPExcel\Settings::PDF_RENDERER_MPDF;
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
|
//$rendererName = PHPExcel\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
$rendererLibrary = 'mPDF5.4';
|
$rendererLibrary = 'mPDF5.4';
|
||||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
|
@ -50,7 +50,7 @@ $rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererL
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
|
@ -82,7 +82,7 @@ $objPHPExcel->getActiveSheet()->setShowGridLines(false);
|
||||||
$objPHPExcel->setActiveSheetIndex(0);
|
$objPHPExcel->setActiveSheetIndex(0);
|
||||||
|
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setPdfRenderer(
|
if (!PHPExcel\Settings::setPdfRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -99,6 +99,6 @@ header('Content-Type: application/pdf');
|
||||||
header('Content-Disposition: attachment;filename="01simple.pdf"');
|
header('Content-Disposition: attachment;filename="01simple.pdf"');
|
||||||
header('Cache-Control: max-age=0');
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
|
||||||
$objWriter->save('php://output');
|
$objWriter->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
|
||||||
die('This example should only be run from a Web Browser');
|
die('This example should only be run from a Web Browser');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
|
@ -84,6 +84,6 @@ header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||||
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header ('Pragma: public'); // HTTP/1.0
|
header ('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save('php://output');
|
$objWriter->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
|
||||||
die('This example should only be run from a Web Browser');
|
die('This example should only be run from a Web Browser');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// Create new PHPExcel object
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
|
@ -84,6 +84,6 @@ header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||||
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||||
header ('Pragma: public'); // HTTP/1.0
|
header ('Pragma: public'); // HTTP/1.0
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save('php://output');
|
$objWriter->save('php://output');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -85,9 +85,9 @@ echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
|
||||||
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
|
PHPExcel\Settings::setZipClass(PHPExcel\Settings::PCLZIP);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -93,28 +93,28 @@ $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean')
|
||||||
$dateTimeNow = time();
|
$dateTimeNow = time();
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
|
$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
|
||||||
->setCellValue('B9', 'Date')
|
->setCellValue('B9', 'Date')
|
||||||
->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
|
->setCellValue('C9', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
|
$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
|
||||||
->setCellValue('B10', 'Time')
|
->setCellValue('B10', 'Time')
|
||||||
->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
|
->setCellValue('C10', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
|
$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
|
$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
|
||||||
->setCellValue('B11', 'Date and Time')
|
->setCellValue('B11', 'Date and Time')
|
||||||
->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
|
->setCellValue('C11', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME);
|
$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_DATETIME);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
|
$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
|
||||||
->setCellValue('C12', NULL);
|
->setCellValue('C12', NULL);
|
||||||
|
|
||||||
$objRichText = new PHPExcel_RichText();
|
$objRichText = new \PHPExcel\RichText();
|
||||||
$objRichText->createText('你好 ');
|
$objRichText->createText('你好 ');
|
||||||
$objPayable = $objRichText->createTextRun('你 好 吗?');
|
$objPayable = $objRichText->createTextRun('你 好 吗?');
|
||||||
$objPayable->getFont()->setBold(true);
|
$objPayable->getFont()->setBold(true);
|
||||||
$objPayable->getFont()->setItalic(true);
|
$objPayable->getFont()->setItalic(true);
|
||||||
$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
|
$objPayable->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_DARKGREEN));
|
||||||
|
|
||||||
$objRichText->createText(', unless specified otherwise on the invoice.');
|
$objRichText->createText(', unless specified otherwise on the invoice.');
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ $objPHPExcel->getActiveSheet()->setCellValue('A13', 'Rich Text')
|
||||||
->setCellValue('C13', $objRichText);
|
->setCellValue('C13', $objRichText);
|
||||||
|
|
||||||
|
|
||||||
$objRichText2 = new PHPExcel_RichText();
|
$objRichText2 = new \PHPExcel\RichText();
|
||||||
$objRichText2->createText("black text\n");
|
$objRichText2->createText("black text\n");
|
||||||
|
|
||||||
$objRed = $objRichText2->createTextRun("red text");
|
$objRed = $objRichText2->createTextRun("red text");
|
||||||
$objRed->getFont()->setColor( new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_RED ) );
|
$objRed->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_RED ));
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getCell("C14")->setValue($objRichText2);
|
$objPHPExcel->getActiveSheet()->getCell("C14")->setValue($objRichText2);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle("C14")->getAlignment()->setWrapText(true);
|
$objPHPExcel->getActiveSheet()->getStyle("C14")->getAlignment()->setWrapText(true);
|
||||||
|
@ -148,7 +148,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
@ -163,7 +163,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Reload workbook from saved file" , EOL;
|
echo date('H:i:s') , " Reload workbook from saved file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__));
|
$objPHPExcel = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__));
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -106,7 +106,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
||||||
|
@ -130,7 +130,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -67,16 +67,16 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
|
||||||
|
|
||||||
// Add a drawing to the header
|
// Add a drawing to the header
|
||||||
echo date('H:i:s') , " Add a drawing to the header" , EOL;
|
echo date('H:i:s') , " Add a drawing to the header" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing();
|
$objDrawing = new \PHPExcel\Worksheet\HeaderFooterDrawing();
|
||||||
$objDrawing->setName('PHPExcel logo');
|
$objDrawing->setName('PHPExcel logo');
|
||||||
$objDrawing->setPath('./images/phpexcel_logo.gif');
|
$objDrawing->setPath('./images/phpexcel_logo.gif');
|
||||||
$objDrawing->setHeight(36);
|
$objDrawing->setHeight(36);
|
||||||
$objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
|
$objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, \PHPExcel\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename worksheet
|
// Rename worksheet
|
||||||
echo date('H:i:s') , " Rename worksheet" , EOL;
|
echo date('H:i:s') , " Rename worksheet" , EOL;
|
||||||
|
@ -91,7 +91,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -106,7 +106,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -29,12 +29,12 @@
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -51,8 +51,8 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
echo date('H:i:s') , " Add some data" , EOL;
|
echo date('H:i:s') , " Add some data" , EOL;
|
||||||
$objPHPExcel->setActiveSheetIndex(0);
|
$objPHPExcel->setActiveSheetIndex(0);
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Invoice');
|
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Invoice');
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('D1', PHPExcel_Shared_Date::PHPToExcel( gmmktime(0,0,0,date('m'),date('d'),date('Y')) ));
|
$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel( gmmktime(0,0,0,date('m'),date('d'),date('Y')) ));
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
|
$objPHPExcel->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15);
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('E1', '#12566');
|
$objPHPExcel->getActiveSheet()->setCellValue('E1', '#12566');
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Product Id');
|
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Product Id');
|
||||||
|
@ -115,13 +115,13 @@ $objPHPExcel->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEE
|
||||||
|
|
||||||
// Add rich-text string
|
// Add rich-text string
|
||||||
echo date('H:i:s') , " Add rich-text string" , EOL;
|
echo date('H:i:s') , " Add rich-text string" , EOL;
|
||||||
$objRichText = new PHPExcel_RichText();
|
$objRichText = new \PHPExcel\RichText();
|
||||||
$objRichText->createText('This invoice is ');
|
$objRichText->createText('This invoice is ');
|
||||||
|
|
||||||
$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
|
$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
|
||||||
$objPayable->getFont()->setBold(true);
|
$objPayable->getFont()->setBold(true);
|
||||||
$objPayable->getFont()->setItalic(true);
|
$objPayable->getFont()->setItalic(true);
|
||||||
$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
|
$objPayable->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_DARKGREEN));
|
||||||
|
|
||||||
$objRichText->createText(', unless specified otherwise on the invoice.');
|
$objRichText->createText(', unless specified otherwise on the invoice.');
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ $objPHPExcel->getActiveSheet()->protectCells('A3:E13', 'PHPExcel');
|
||||||
|
|
||||||
// Set cell number formats
|
// Set cell number formats
|
||||||
echo date('H:i:s') , " Set cell number formats" , EOL;
|
echo date('H:i:s') , " Set cell number formats" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objPHPExcel->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
// Set column widths
|
// Set column widths
|
||||||
echo date('H:i:s') , " Set column widths" , EOL;
|
echo date('H:i:s') , " Set column widths" , EOL;
|
||||||
|
@ -153,23 +153,23 @@ echo date('H:i:s') , " Set fonts" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
|
$objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
|
$objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_WHITE);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
|
$objPHPExcel->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
|
$objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
|
||||||
|
|
||||||
// Set alignments
|
// Set alignments
|
||||||
echo date('H:i:s') , " Set alignments" , EOL;
|
echo date('H:i:s') , " Set alignments" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
$objPHPExcel->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
$objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
$objPHPExcel->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
|
$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
|
$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PHPExcel\Style\Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
|
$objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ echo date('H:i:s') , " Set thin black border outline around column" , EOL;
|
||||||
$styleThinBlackBorderOutline = array(
|
$styleThinBlackBorderOutline = array(
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'outline' => array(
|
'outline' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THIN,
|
'style' => \PHPExcel\Style\Border::BORDER_THIN,
|
||||||
'color' => array('argb' => 'FF000000'),
|
'color' => array('argb' => 'FF000000'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -191,7 +191,7 @@ echo date('H:i:s') , " Set thick brown border outline around Total" , EOL;
|
||||||
$styleThickBrownBorderOutline = array(
|
$styleThickBrownBorderOutline = array(
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'outline' => array(
|
'outline' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THICK,
|
'style' => \PHPExcel\Style\Border::BORDER_THICK,
|
||||||
'color' => array('argb' => 'FF993300'),
|
'color' => array('argb' => 'FF993300'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -200,7 +200,7 @@ $objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickB
|
||||||
|
|
||||||
// Set fills
|
// Set fills
|
||||||
echo date('H:i:s') , " Set fills" , EOL;
|
echo date('H:i:s') , " Set fills" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
|
$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(\PHPExcel\Style\Fill::FILL_SOLID);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080');
|
$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080');
|
||||||
|
|
||||||
// Set style for header row using alternative method
|
// Set style for header row using alternative method
|
||||||
|
@ -211,15 +211,15 @@ $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
|
||||||
'bold' => true
|
'bold' => true
|
||||||
),
|
),
|
||||||
'alignment' => array(
|
'alignment' => array(
|
||||||
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
|
'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT,
|
||||||
),
|
),
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'top' => array(
|
'top' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THIN
|
'style' => \PHPExcel\Style\Border::BORDER_THIN
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'fill' => array(
|
'fill' => array(
|
||||||
'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
|
'type' => \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR,
|
||||||
'rotation' => 90,
|
'rotation' => 90,
|
||||||
'startcolor' => array(
|
'startcolor' => array(
|
||||||
'argb' => 'FFA0A0A0'
|
'argb' => 'FFA0A0A0'
|
||||||
|
@ -234,11 +234,11 @@ $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
|
$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
|
||||||
array(
|
array(
|
||||||
'alignment' => array(
|
'alignment' => array(
|
||||||
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
|
'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT,
|
||||||
),
|
),
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'left' => array(
|
'left' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THIN
|
'style' => \PHPExcel\Style\Border::BORDER_THIN
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -247,7 +247,7 @@ $objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray(
|
$objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray(
|
||||||
array(
|
array(
|
||||||
'alignment' => array(
|
'alignment' => array(
|
||||||
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
|
'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -256,7 +256,7 @@ $objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray(
|
||||||
array(
|
array(
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'right' => array(
|
'right' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THIN
|
'style' => \PHPExcel\Style\Border::BORDER_THIN
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -264,24 +264,24 @@ $objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray(
|
||||||
|
|
||||||
// Unprotect a cell
|
// Unprotect a cell
|
||||||
echo date('H:i:s') , " Unprotect a cell" , EOL;
|
echo date('H:i:s') , " Unprotect a cell" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
|
$objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(\PHPExcel\Style\Protection::PROTECTION_UNPROTECTED);
|
||||||
|
|
||||||
// Add a hyperlink to the sheet
|
// Add a hyperlink to the sheet
|
||||||
echo date('H:i:s') , " Add a hyperlink to an external website" , EOL;
|
echo date('H:i:s') , " Add a hyperlink to an external website" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
|
$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
|
||||||
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
|
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
|
||||||
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
|
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
$objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
echo date('H:i:s') , " Add a hyperlink to another cell on a different worksheet within the workbook" , EOL;
|
echo date('H:i:s') , " Add a hyperlink to another cell on a different worksheet within the workbook" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
|
$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
|
||||||
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
|
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
|
||||||
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
|
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
|
$objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_Drawing();
|
$objDrawing = new \PHPExcel\Worksheet\Drawing();
|
||||||
$objDrawing->setName('Logo');
|
$objDrawing->setName('Logo');
|
||||||
$objDrawing->setDescription('Logo');
|
$objDrawing->setDescription('Logo');
|
||||||
$objDrawing->setPath('./images/officelogo.jpg');
|
$objDrawing->setPath('./images/officelogo.jpg');
|
||||||
|
@ -290,7 +290,7 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_Drawing();
|
$objDrawing = new \PHPExcel\Worksheet\Drawing();
|
||||||
$objDrawing->setName('Paid');
|
$objDrawing->setName('Paid');
|
||||||
$objDrawing->setDescription('Paid');
|
$objDrawing->setDescription('Paid');
|
||||||
$objDrawing->setPath('./images/paid.png');
|
$objDrawing->setPath('./images/paid.png');
|
||||||
|
@ -303,7 +303,7 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_Drawing();
|
$objDrawing = new \PHPExcel\Worksheet\Drawing();
|
||||||
$objDrawing->setName('PHPExcel logo');
|
$objDrawing->setName('PHPExcel logo');
|
||||||
$objDrawing->setDescription('PHPExcel logo');
|
$objDrawing->setDescription('PHPExcel logo');
|
||||||
$objDrawing->setPath('./images/phpexcel_logo.gif');
|
$objDrawing->setPath('./images/phpexcel_logo.gif');
|
||||||
|
@ -326,8 +326,8 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename first worksheet
|
// Rename first worksheet
|
||||||
echo date('H:i:s') , " Rename first worksheet" , EOL;
|
echo date('H:i:s') , " Rename first worksheet" , EOL;
|
||||||
|
@ -367,13 +367,13 @@ echo date('H:i:s') , " Set fonts" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
|
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
|
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8);
|
$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_Drawing();
|
$objDrawing = new \PHPExcel\Worksheet\Drawing();
|
||||||
$objDrawing->setName('Terms and conditions');
|
$objDrawing->setName('Terms and conditions');
|
||||||
$objDrawing->setDescription('Terms and conditions');
|
$objDrawing->setDescription('Terms and conditions');
|
||||||
$objDrawing->setPath('./images/termsconditions.jpg');
|
$objDrawing->setPath('./images/termsconditions.jpg');
|
||||||
|
@ -382,8 +382,8 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
// Rename second worksheet
|
// Rename second worksheet
|
||||||
echo date('H:i:s') , " Rename second worksheet" , EOL;
|
echo date('H:i:s') , " Rename second worksheet" , EOL;
|
||||||
|
|
|
@ -36,15 +36,11 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
|
||||||
|
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -59,7 +55,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite;
|
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE;
|
||||||
if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
|
if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
} else {
|
} else {
|
||||||
echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
|
echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
|
||||||
|
@ -47,7 +47,7 @@ if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -110,7 +110,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
|
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
|
||||||
if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
|
if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
} else {
|
} else {
|
||||||
echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
|
echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
|
||||||
|
@ -47,7 +47,7 @@ if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -110,7 +110,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
|
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
|
||||||
if (!PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
|
if (!\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
|
||||||
die($cacheMethod . " caching method is not available" . EOL);
|
die($cacheMethod . " caching method is not available" . EOL);
|
||||||
}
|
}
|
||||||
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
|
||||||
|
@ -46,7 +46,7 @@ echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" ,
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -109,7 +109,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,7 +54,7 @@ for writing to Excel2007:
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -117,7 +117,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,7 +54,7 @@ for writing to Excel2007:
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set properties" , EOL;
|
echo date('H:i:s') , " Set properties" , EOL;
|
||||||
|
@ -117,7 +117,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists("05featuredemo.xlsx")) {
|
if (!file_exists("05featuredemo.xlsx")) {
|
||||||
|
@ -44,7 +44,7 @@ if (!file_exists("05featuredemo.xlsx")) {
|
||||||
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
|
$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx");
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -56,7 +56,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
|
@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists("05featuredemo.xlsx")) {
|
if (!file_exists("05featuredemo.xlsx")) {
|
||||||
|
@ -42,12 +42,12 @@ if (!file_exists("05featuredemo.xlsx")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||||
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
|
\PHPExcel\Settings::setZipClass(\PHPExcel\Settings::PCLZIP);
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
|
$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx");
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -59,7 +59,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -86,30 +86,30 @@ $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
|
||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
||||||
$objConditional1 = new PHPExcel_Style_Conditional();
|
$objConditional1 = new \PHPExcel\Style\Conditional();
|
||||||
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN)
|
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_BETWEEN)
|
||||||
->addCondition('200')
|
->addCondition('200')
|
||||||
->addCondition('400');
|
->addCondition('400');
|
||||||
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW);
|
$objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_YELLOW);
|
||||||
$objConditional1->getStyle()->getFont()->setBold(true);
|
$objConditional1->getStyle()->getFont()->setBold(true);
|
||||||
$objConditional1->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional1->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$objConditional2 = new PHPExcel_Style_Conditional();
|
$objConditional2 = new \PHPExcel\Style\Conditional();
|
||||||
$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional2->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
|
$objConditional2->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_RED);
|
||||||
$objConditional2->getStyle()->getFont()->setItalic(true);
|
$objConditional2->getStyle()->getFont()->setItalic(true);
|
||||||
$objConditional2->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional2->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$objConditional3 = new PHPExcel_Style_Conditional();
|
$objConditional3 = new \PHPExcel\Style\Conditional();
|
||||||
$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
|
$objConditional3->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_GREEN);
|
||||||
$objConditional3->getStyle()->getFont()->setItalic(true);
|
$objConditional3->getStyle()->getFont()->setItalic(true);
|
||||||
$objConditional3->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
$objConditional3->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
|
||||||
|
|
||||||
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $objConditional1);
|
array_push($conditionalStyles, $objConditional1);
|
||||||
|
@ -142,8 +142,8 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
|
||||||
|
|
||||||
// Set page orientation and size
|
// Set page orientation and size
|
||||||
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
echo date('H:i:s') , " Set page orientation and size" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
|
||||||
|
|
||||||
|
|
||||||
// Rename worksheet
|
// Rename worksheet
|
||||||
|
@ -159,7 +159,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -170,7 +170,7 @@ echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds"
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -70,23 +70,23 @@ $objPHPExcel->getActiveSheet()
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
|
$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
|
||||||
->getNumberFormat()
|
->getNumberFormat()
|
||||||
->setFormatCode(
|
->setFormatCode(
|
||||||
PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
|
\PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Add conditional formatting
|
// Add conditional formatting
|
||||||
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
echo date('H:i:s') , " Add conditional formatting" , EOL;
|
||||||
$objConditional1 = new PHPExcel_Style_Conditional();
|
$objConditional1 = new \PHPExcel\Style\Conditional();
|
||||||
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
|
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN)
|
||||||
->addCondition('0');
|
->addCondition('0');
|
||||||
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
|
$objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_RED);
|
||||||
|
|
||||||
$objConditional3 = new PHPExcel_Style_Conditional();
|
$objConditional3 = new \PHPExcel\Style\Conditional();
|
||||||
$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
|
$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
|
||||||
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
|
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
|
||||||
->addCondition('1');
|
->addCondition('1');
|
||||||
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
|
$objConditional3->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_GREEN);
|
||||||
|
|
||||||
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles();
|
||||||
array_push($conditionalStyles, $objConditional1);
|
array_push($conditionalStyles, $objConditional1);
|
||||||
|
@ -106,7 +106,7 @@ $objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -117,7 +117,7 @@ echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds"
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -74,7 +74,7 @@ for ($i = 2; $i <= 50; $i++) {
|
||||||
// Add page breaks every 10 rows
|
// Add page breaks every 10 rows
|
||||||
if ($i % 10 == 0) {
|
if ($i % 10 == 0) {
|
||||||
// Add a page break
|
// Add a page break
|
||||||
$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, PHPExcel_Worksheet::BREAK_ROW );
|
$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, \PHPExcel\Worksheet::BREAK_ROW );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ $objPHPExcel->getActiveSheet()
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -115,7 +115,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s').' Set document properties'.EOL;
|
echo date('H:i:s').' Set document properties'.EOL;
|
||||||
|
@ -77,7 +77,7 @@ foreach($years as $year) {
|
||||||
foreach($countries as $country) {
|
foreach($countries as $country) {
|
||||||
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
||||||
for($i = 1; $i <= $endDays; ++$i) {
|
for($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
|
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -116,8 +116,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -136,45 +136,45 @@ 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)
|
// 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
|
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'u*'
|
'u*'
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'japan'
|
'japan'
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
// Filter the Date column on a filter value of the first day of every period of the current year
|
// Filter the Date column on a filter value of the first day of every period of the current year
|
||||||
// We us a dateGroup ruletype for this, although it is still a standard filter
|
// We us a dateGroup ruletype for this, although it is still a standard filter
|
||||||
foreach($periods as $period) {
|
foreach($periods as $period) {
|
||||||
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
|
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
|
||||||
|
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
array(
|
array(
|
||||||
'year' => $currentYear,
|
'year' => $currentYear,
|
||||||
'month' => $period,
|
'month' => $period,
|
||||||
'day' => $endDate
|
'day' => $endDate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
||||||
}
|
}
|
||||||
// Display only sales values that are blank
|
// Display only sales values that are blank
|
||||||
// Standard filter, operator equals, and value of NULL
|
// Standard filter, operator equals, and value of NULL
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -202,7 +202,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s').' Set document properties'.EOL;
|
echo date('H:i:s').' Set document properties'.EOL;
|
||||||
|
@ -59,8 +59,7 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
|
||||||
->setCellValue('C1', 'Country')
|
->setCellValue('C1', 'Country')
|
||||||
->setCellValue('D1', 'Date')
|
->setCellValue('D1', 'Date')
|
||||||
->setCellValue('E1', 'Sales Value')
|
->setCellValue('E1', 'Sales Value')
|
||||||
->setCellValue('F1', 'Expenditure')
|
->setCellValue('F1', 'Expenditure');
|
||||||
;
|
|
||||||
$startYear = $endYear = $currentYear = date('Y');
|
$startYear = $endYear = $currentYear = date('Y');
|
||||||
$startYear--;
|
$startYear--;
|
||||||
$endYear++;
|
$endYear++;
|
||||||
|
@ -77,7 +76,7 @@ foreach($years as $year) {
|
||||||
foreach($countries as $country) {
|
foreach($countries as $country) {
|
||||||
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
||||||
for($i = 1; $i <= $endDays; ++$i) {
|
for($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
|
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -116,8 +115,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -136,39 +135,39 @@ echo date('H:i:s').' Set active filters'.EOL;
|
||||||
// Filter the Country column on a filter value of Germany
|
// Filter the Country column on a filter value of Germany
|
||||||
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
|
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'Germany'
|
'Germany'
|
||||||
);
|
);
|
||||||
// Filter the Date column on a filter value of the year to date
|
// Filter the Date column on a filter value of the year to date
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
NULL,
|
NULL,
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
||||||
// Display only sales values that are between 400 and 600
|
// Display only sales values that are between 400 and 600
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
|
||||||
400
|
400
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)
|
->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
|
||||||
600
|
600
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
|
|
||||||
|
|
||||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||||
|
@ -179,7 +178,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -194,7 +193,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s').' Set document properties'.EOL;
|
echo date('H:i:s').' Set document properties'.EOL;
|
||||||
|
@ -77,7 +77,7 @@ foreach($years as $year) {
|
||||||
foreach($countries as $country) {
|
foreach($countries as $country) {
|
||||||
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
$endDays = date('t',mktime(0,0,0,$period,1,$year));
|
||||||
for($i = 1; $i <= $endDays; ++$i) {
|
for($i = 1; $i <= $endDays; ++$i) {
|
||||||
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
|
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
|
||||||
$year,
|
$year,
|
||||||
$period,
|
$period,
|
||||||
$i
|
$i
|
||||||
|
@ -116,8 +116,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
|
||||||
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
$objPHPExcel->getActiveSheet()->freezePane('A2');
|
||||||
|
|
||||||
|
@ -136,45 +136,45 @@ 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)
|
// 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
|
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'u*'
|
'u*'
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
$autoFilter->getColumn('C')
|
$autoFilter->getColumn('C')
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
'japan'
|
'japan'
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
||||||
// Filter the Date column on a filter value of the first day of every period of the current year
|
// Filter the Date column on a filter value of the first day of every period of the current year
|
||||||
// We us a dateGroup ruletype for this, although it is still a standard filter
|
// We us a dateGroup ruletype for this, although it is still a standard filter
|
||||||
foreach($periods as $period) {
|
foreach($periods as $period) {
|
||||||
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
|
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
|
||||||
|
|
||||||
$autoFilter->getColumn('D')
|
$autoFilter->getColumn('D')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
array(
|
array(
|
||||||
'year' => $currentYear,
|
'year' => $currentYear,
|
||||||
'month' => $period,
|
'month' => $period,
|
||||||
'day' => $endDate
|
'day' => $endDate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
||||||
}
|
}
|
||||||
// Display only sales values that are blank
|
// Display only sales values that are blank
|
||||||
// Standard filter, operator equals, and value of NULL
|
// Standard filter, operator equals, and value of NULL
|
||||||
$autoFilter->getColumn('E')
|
$autoFilter->getColumn('E')
|
||||||
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
|
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
|
||||||
->createRule()
|
->createRule()
|
||||||
->setRule(
|
->setRule(
|
||||||
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s').' Set document properties'.EOL;
|
echo date('H:i:s').' Set document properties'.EOL;
|
||||||
|
@ -137,7 +137,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -152,7 +152,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -90,7 +90,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -90,7 +90,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -76,7 +76,7 @@ $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
|
||||||
$objPHPExcel->getActiveSheet()
|
$objPHPExcel->getActiveSheet()
|
||||||
->getStyle('A2:B2')
|
->getStyle('A2:B2')
|
||||||
->getProtection()->setLocked(
|
->getProtection()->setLocked(
|
||||||
PHPExcel_Style_Protection::PROTECTION_UNPROTECTED
|
\PHPExcel\Style\Protection::PROTECTION_UNPROTECTED
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -37,17 +37,17 @@ date_default_timezone_set('Europe/London');
|
||||||
mt_srand(1234567890);
|
mt_srand(1234567890);
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// List functions
|
// List functions
|
||||||
echo date('H:i:s') , " List implemented functions" , EOL;
|
echo date('H:i:s') , " List implemented functions" , EOL;
|
||||||
$objCalc = PHPExcel_Calculation::getInstance();
|
$objCalc = \PHPExcel\Calculation::getInstance();
|
||||||
print_r($objCalc->listFunctionNames());
|
print_r($objCalc->listFunctionNames());
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// Add some data, we will use some formulas here
|
||||||
echo date('H:i:s') , " Add some data and formulas" , EOL;
|
echo date('H:i:s') , " Add some data and formulas" , EOL;
|
||||||
|
@ -207,7 +207,7 @@ for ($col = 'B'; $col != 'G'; ++$col) {
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// Add some data, we will use some formulas here
|
||||||
echo date('H:i:s') , " Add some data and formulas" , EOL;
|
echo date('H:i:s') , " Add some data and formulas" , EOL;
|
||||||
|
@ -50,7 +50,7 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1')
|
||||||
->setCellValue('B1', '=A1+1')
|
->setCellValue('B1', '=A1+1')
|
||||||
->setCellValue('B2', '=A2');
|
->setCellValue('B2', '=A2');
|
||||||
|
|
||||||
PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100;
|
\PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100;
|
||||||
|
|
||||||
// Calculated data
|
// Calculated data
|
||||||
echo date('H:i:s') , " Calculated data" , EOL;
|
echo date('H:i:s') , " Calculated data" , EOL;
|
||||||
|
@ -69,7 +69,7 @@ for($row = 1; $row <= 2; ++$row) {
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
|
||||||
|
|
|
@ -36,15 +36,15 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Save Excel 95 file
|
// Save Excel 95 file
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
|
@ -76,8 +76,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data
|
||||||
// Set data validation
|
// Set data validation
|
||||||
echo date('H:i:s') , " Set data validation" , EOL;
|
echo date('H:i:s') , " Set data validation" , EOL;
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP );
|
||||||
$objValidation->setAllowBlank(true);
|
$objValidation->setAllowBlank(true);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -89,8 +89,8 @@ $objValidation->setFormula1(10);
|
||||||
$objValidation->setFormula2(20);
|
$objValidation->setFormula2(20);
|
||||||
|
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
|
||||||
$objValidation->setAllowBlank(false);
|
$objValidation->setAllowBlank(false);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -102,8 +102,8 @@ $objValidation->setPrompt('Please pick a value from the drop-down list.');
|
||||||
$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!!
|
$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!!
|
||||||
|
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
|
||||||
$objValidation->setAllowBlank(false);
|
$objValidation->setAllowBlank(false);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -123,7 +123,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
|
@ -76,8 +76,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data
|
||||||
// Set data validation
|
// Set data validation
|
||||||
echo date('H:i:s') , " Set data validation" , EOL;
|
echo date('H:i:s') , " Set data validation" , EOL;
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP );
|
||||||
$objValidation->setAllowBlank(true);
|
$objValidation->setAllowBlank(true);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -89,8 +89,8 @@ $objValidation->setFormula1(10);
|
||||||
$objValidation->setFormula2(20);
|
$objValidation->setFormula2(20);
|
||||||
|
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
|
||||||
$objValidation->setAllowBlank(false);
|
$objValidation->setAllowBlank(false);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -103,8 +103,8 @@ $objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the l
|
||||||
|
|
||||||
|
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
|
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
|
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
|
||||||
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
|
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
|
||||||
$objValidation->setAllowBlank(false);
|
$objValidation->setAllowBlank(false);
|
||||||
$objValidation->setShowInputMessage(true);
|
$objValidation->setShowInputMessage(true);
|
||||||
$objValidation->setShowErrorMessage(true);
|
$objValidation->setShowErrorMessage(true);
|
||||||
|
@ -124,7 +124,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once '../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to CSV format" , EOL;
|
echo date('H:i:s') , " Write to CSV format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
|
||||||
->setEnclosure('"')
|
->setEnclosure('"')
|
||||||
->setSheetIndex(0)
|
->setSheetIndex(0)
|
||||||
->save(str_replace('.php', '.csv', __FILE__));
|
->save(str_replace('.php', '.csv', __FILE__));
|
||||||
|
@ -58,7 +58,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
|
|
||||||
echo date('H:i:s') , " Read from CSV format" , EOL;
|
echo date('H:i:s') , " Read from CSV format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
$objReader = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')
|
$objReader = \PHPExcel\IOFactory::createReader('CSV')->setDelimiter(',')
|
||||||
->setEnclosure('"')
|
->setEnclosure('"')
|
||||||
->setSheetIndex(0);
|
->setSheetIndex(0);
|
||||||
$objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__));
|
$objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__));
|
||||||
|
@ -73,7 +73,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter2007 = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
|
$objWriter2007 = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
|
||||||
$objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -86,7 +86,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to CSV format" , EOL;
|
echo date('H:i:s') , " Write to CSV format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriterCSV = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
|
$objWriterCSV = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
|
||||||
$objWriterCSV->setExcelCompatibility(true);
|
$objWriterCSV->setExcelCompatibility(true);
|
||||||
$objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__));
|
$objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
|
@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to HTML format" , EOL;
|
echo date('H:i:s') , " Write to HTML format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
|
||||||
$objWriter->setSheetIndex(0);
|
$objWriter->setSheetIndex(0);
|
||||||
//$objWriter->setImagesRoot('http://www.example.com');
|
//$objWriter->setImagesRoot('http://www.example.com');
|
||||||
$objWriter->save(str_replace('.php', '.htm', __FILE__));
|
$objWriter->save(str_replace('.php', '.htm', __FILE__));
|
||||||
|
|
|
@ -36,17 +36,17 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// List functions
|
// List functions
|
||||||
echo date('H:i:s') . " List implemented functions\n";
|
echo date('H:i:s') . " List implemented functions\n";
|
||||||
$objCalc = PHPExcel_Calculation::getInstance();
|
$objCalc = \PHPExcel\Calculation::getInstance();
|
||||||
print_r($objCalc->listFunctionNames());
|
print_r($objCalc->listFunctionNames());
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Add some data, we will use some formulas here
|
// 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";
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -66,8 +66,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:')
|
||||||
|
|
||||||
// Define named ranges
|
// Define named ranges
|
||||||
echo date('H:i:s') , " Define named ranges" , EOL;
|
echo date('H:i:s') , " Define named ranges" , EOL;
|
||||||
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') );
|
$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') );
|
||||||
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
|
$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
|
||||||
|
|
||||||
// Rename named ranges
|
// Rename named ranges
|
||||||
echo date('H:i:s') , " Rename named ranges" , EOL;
|
echo date('H:i:s') , " Rename named ranges" , EOL;
|
||||||
|
@ -110,7 +110,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -35,8 +35,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists("14excel5.xls")) {
|
if (!file_exists("14excel5.xls")) {
|
||||||
|
@ -46,7 +46,7 @@ if (!file_exists("14excel5.xls")) {
|
||||||
echo date('H:i:s') , " Load workbook from Excel5 file" , EOL;
|
echo date('H:i:s') , " Load workbook from Excel5 file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load("14excel5.xls");
|
$objPHPExcel = \PHPExcel\IOFactory::load("14excel5.xls");
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -60,7 +60,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -37,15 +37,15 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF;
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
|
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF;
|
||||||
$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
|
$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
//$rendererLibrary = 'mPDF5.4';
|
//$rendererLibrary = 'mPDF5.4';
|
||||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
|
@ -56,12 +56,12 @@ echo date('H:i:s') , " Hide grid lines" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->setShowGridLines(false);
|
$objPHPExcel->getActiveSheet()->setShowGridLines(false);
|
||||||
|
|
||||||
echo date('H:i:s') , " Set orientation to landscape" , EOL;
|
echo date('H:i:s') , " Set orientation to landscape" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
|
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL;
|
echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL;
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setPdfRenderer(
|
if (!\PHPExcel\Settings::setPdfRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -75,7 +75,7 @@ if (!PHPExcel_Settings::setPdfRenderer(
|
||||||
|
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
|
||||||
$objWriter->setSheetIndex(0);
|
$objWriter->setSheetIndex(0);
|
||||||
$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__));
|
$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -60,19 +60,19 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
|
$objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
|
||||||
array('fill' => array(
|
array('fill' => array(
|
||||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
|
||||||
'color' => array('argb' => 'FFCCFFCC')
|
'color' => array('argb' => 'FFCCFFCC')
|
||||||
),
|
),
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
|
||||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
$objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
||||||
array('fill' => array(
|
array('fill' => array(
|
||||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
|
||||||
'color' => array('argb' => 'FFFFFF00')
|
'color' => array('argb' => 'FFFFFF00')
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -82,7 +82,7 @@ $objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -97,7 +97,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -58,39 +58,39 @@ $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
|
||||||
echo date('H:i:s') , " Add some data" , EOL;
|
echo date('H:i:s') , " Add some data" , EOL;
|
||||||
$objPHPExcel->setActiveSheetIndex(0);
|
$objPHPExcel->setActiveSheetIndex(0);
|
||||||
|
|
||||||
$sharedStyle1 = new PHPExcel_Style();
|
$sharedStyle1 = new \PHPExcel\Style();
|
||||||
$sharedStyle2 = new PHPExcel_Style();
|
$sharedStyle2 = new \PHPExcel\Style();
|
||||||
|
|
||||||
$sharedStyle1->applyFromArray(
|
$sharedStyle1->applyFromArray(
|
||||||
array('fill' => array(
|
array('fill' => array(
|
||||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
|
||||||
'color' => array('argb' => 'FFCCFFCC')
|
'color' => array('argb' => 'FFCCFFCC')
|
||||||
),
|
),
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
|
||||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$sharedStyle2->applyFromArray(
|
$sharedStyle2->applyFromArray(
|
||||||
array('fill' => array(
|
array('fill' => array(
|
||||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
|
||||||
'color' => array('argb' => 'FFFFFF00')
|
'color' => array('argb' => 'FFFFFF00')
|
||||||
),
|
),
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
|
||||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A1:T100");
|
$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle1, "A1:T100");
|
||||||
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, "C5:R95");
|
$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95");
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -105,7 +105,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Check prerequisites
|
// Check prerequisites
|
||||||
|
@ -42,7 +42,7 @@ if (!file_exists("06largescale.xlsx")) {
|
||||||
exit("Please run 06largescale.php first.\n");
|
exit("Please run 06largescale.php first.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
class MyReadFilter implements \PHPExcel\Reader\IReadFilter
|
||||||
{
|
{
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '') {
|
||||||
// Read title row and rows 20 - 30
|
// Read title row and rows 20 - 30
|
||||||
|
@ -56,7 +56,7 @@ class MyReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel2007');
|
||||||
$objReader->setReadFilter( new MyReadFilter() );
|
$objReader->setReadFilter( new MyReadFilter() );
|
||||||
$objPHPExcel = $objReader->load("06largescale.xlsx");
|
$objPHPExcel = $objReader->load("06largescale.xlsx");
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ echo date('H:i:s') , " Remove unnecessary rows" , EOL;
|
||||||
$objPHPExcel->getActiveSheet()->removeRow(2, 18);
|
$objPHPExcel->getActiveSheet()->removeRow(2, 18);
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -60,23 +60,23 @@ imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor);
|
||||||
|
|
||||||
// Add a drawing to the worksheet
|
// Add a drawing to the worksheet
|
||||||
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
|
||||||
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
|
$objDrawing = new \PHPExcel\Worksheet\MemoryDrawing();
|
||||||
$objDrawing->setName('Sample image');
|
$objDrawing->setName('Sample image');
|
||||||
$objDrawing->setDescription('Sample image');
|
$objDrawing->setDescription('Sample image');
|
||||||
$objDrawing->setImageResource($gdImage);
|
$objDrawing->setImageResource($gdImage);
|
||||||
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
|
$objDrawing->setRenderingFunction(\PHPExcel\Worksheet\MemoryDrawing::RENDERING_JPEG);
|
||||||
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
|
$objDrawing->setMimeType(\PHPExcel\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
|
||||||
$objDrawing->setHeight(36);
|
$objDrawing->setHeight(36);
|
||||||
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to HTML format" , EOL;
|
echo date('H:i:s') , " Write to HTML format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
|
||||||
$objWriter->save(str_replace('.php', '.html', __FILE__));
|
$objWriter->save(str_replace('.php', '.html', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the PDF Rendering library that you wish to use
|
// Change these values to select the PDF Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF;
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
|
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF;
|
||||||
$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
|
$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
//$rendererLibrary = 'mPDF5.4';
|
//$rendererLibrary = 'mPDF5.4';
|
||||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
|
@ -51,33 +51,33 @@ $rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||||
|
|
||||||
// Read from Excel2007 (.xlsx) template
|
// Read from Excel2007 (.xlsx) template
|
||||||
echo date('H:i:s') , " Load Excel2007 template file" , EOL;
|
echo date('H:i:s') , " Load Excel2007 template file" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel2007');
|
||||||
$objPHPExcel = $objReader->load("templates/26template.xlsx");
|
$objPHPExcel = $objReader->load("templates/26template.xlsx");
|
||||||
|
|
||||||
/** at this point, we could do some manipulations with the template, but we skip this step */
|
/** at this point, we could do some manipulations with the template, but we skip this step */
|
||||||
|
|
||||||
// Export to Excel2007 (.xlsx)
|
// Export to Excel2007 (.xlsx)
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
// Export to Excel5 (.xls)
|
// Export to Excel5 (.xls)
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
// Export to HTML (.html)
|
// Export to HTML (.html)
|
||||||
echo date('H:i:s') , " Write to HTML format" , EOL;
|
echo date('H:i:s') , " Write to HTML format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
|
||||||
$objWriter->save(str_replace('.php', '.htm', __FILE__));
|
$objWriter->save(str_replace('.php', '.htm', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
// Export to PDF (.pdf)
|
// Export to PDF (.pdf)
|
||||||
echo date('H:i:s') , " Write to PDF format" , EOL;
|
echo date('H:i:s') , " Write to PDF format" , EOL;
|
||||||
try {
|
try {
|
||||||
if (!PHPExcel_Settings::setPdfRenderer(
|
if (!\PHPExcel\Settings::setPdfRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -88,7 +88,7 @@ try {
|
||||||
EOL
|
EOL
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
|
||||||
$objWriter->save(str_replace('.php', '.pdf', __FILE__));
|
$objWriter->save(str_replace('.php', '.pdf', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ $objWorksheet->removeRow(1, 2);
|
||||||
|
|
||||||
// Export to CSV (.csv)
|
// Export to CSV (.csv)
|
||||||
echo date('H:i:s') , " Write to CSV format" , EOL;
|
echo date('H:i:s') , " Write to CSV format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV');
|
||||||
$objWriter->save(str_replace('.php', '.csv', __FILE__));
|
$objWriter->save(str_replace('.php', '.csv', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -35,23 +35,23 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Read from Excel5 (.xls) template
|
// Read from Excel5 (.xls) template
|
||||||
echo date('H:i:s') , " Load Excel2007 template file" , EOL;
|
echo date('H:i:s') , " Load Excel2007 template file" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel5');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel5');
|
||||||
$objPHPExcel = $objReader->load("templates/27template.xls");
|
$objPHPExcel = $objReader->load("templates/27template.xls");
|
||||||
|
|
||||||
// Export to Excel2007 (.xlsx)
|
// Export to Excel2007 (.xlsx)
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
// Export to Excel5 (.xls)
|
// Export to Excel5 (.xls)
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -34,16 +34,15 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists("05featuredemo.xlsx")) {
|
if (!file_exists("05featuredemo.xlsx")) {
|
||||||
exit("Please run 05featuredemo.php first." . EOL);
|
exit("Please run 05featuredemo.php first." . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel2007');
|
||||||
$objPHPExcel = $objReader->load("05featuredemo.xlsx");
|
$objPHPExcel = $objReader->load("05featuredemo.xlsx");
|
||||||
|
|
||||||
echo date('H:i:s') , " Iterate worksheets" , EOL;
|
echo date('H:i:s') , " Iterate worksheets" , EOL;
|
||||||
|
|
|
@ -33,7 +33,7 @@ ini_set('display_startup_errors', TRUE);
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Set timezone
|
// Set timezone
|
||||||
|
@ -42,11 +42,11 @@ date_default_timezone_set('UTC');
|
||||||
|
|
||||||
// Set value binder
|
// Set value binder
|
||||||
echo date('H:i:s') , " Set value binder" , EOL;
|
echo date('H:i:s') , " Set value binder" , EOL;
|
||||||
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
|
\PHPExcel\Cell::setValueBinder( new \PHPExcel\Cell\AdvancedValueBinder() );
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -165,12 +165,12 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
// Save Excel5 file
|
// Save Excel5 file
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel5 template" , EOL;
|
echo date('H:i:s') , " Load from Excel5 template" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel5');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel5');
|
||||||
$objPHPExcel = $objReader->load("templates/30template.xls");
|
$objPHPExcel = $objReader->load("templates/30template.xls");
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ $data = array(array('title' => 'Excel for dummies',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('D1', PHPExcel_Shared_Date::PHPToExcel(time()));
|
$objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel(time()));
|
||||||
|
|
||||||
$baseRow = 5;
|
$baseRow = 5;
|
||||||
foreach($data as $r => $dataRow) {
|
foreach($data as $r => $dataRow) {
|
||||||
|
@ -78,7 +78,7 @@ $objPHPExcel->getActiveSheet()->removeRow($baseRow-1,1);
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Excel5';
|
$inputFileType = 'Excel5';
|
||||||
|
@ -45,7 +45,7 @@ $inputFileName = 'templates/31docproperties.xls';
|
||||||
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
|
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
|
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
@ -64,7 +64,7 @@ $objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document")
|
||||||
|
|
||||||
// Save Excel 95 file
|
// Save Excel 95 file
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 102
|
||||||
echo EOL;
|
echo EOL;
|
||||||
// Reread File
|
// Reread File
|
||||||
echo date('H:i:s') , " Reread Excel5 file" , EOL;
|
echo date('H:i:s') , " Reread Excel5 file" , EOL;
|
||||||
$objPHPExcelRead = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__));
|
$objPHPExcelRead = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__));
|
||||||
|
|
||||||
// Set properties
|
// Set properties
|
||||||
echo date('H:i:s') , " Get properties" , EOL;
|
echo date('H:i:s') , " Get properties" , EOL;
|
||||||
|
@ -106,9 +106,9 @@ foreach($customProperties as $customProperty) {
|
||||||
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||||
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||||
echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
|
echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
|
||||||
if ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE) {
|
if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) {
|
||||||
echo date('d-M-Y H:i:s',$propertyValue) , EOL;
|
echo date('d-M-Y H:i:s',$propertyValue) , EOL;
|
||||||
} elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
|
} elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
||||||
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
|
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
|
||||||
} else {
|
} else {
|
||||||
echo $propertyValue , EOL;
|
echo $propertyValue , EOL;
|
||||||
|
|
|
@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Excel2007';
|
$inputFileType = 'Excel2007';
|
||||||
|
@ -45,7 +45,7 @@ $inputFileName = 'templates/31docproperties.xlsx';
|
||||||
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
|
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
|
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
@ -64,7 +64,7 @@ $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document")
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 102
|
||||||
echo EOL;
|
echo EOL;
|
||||||
// Reread File
|
// Reread File
|
||||||
echo date('H:i:s') , " Reread Excel2007 file" , EOL;
|
echo date('H:i:s') , " Reread Excel2007 file" , EOL;
|
||||||
$objPHPExcelRead = PHPExcel_IOFactory::load(str_replace('.php', '.xlsx', __FILE__));
|
$objPHPExcelRead = \PHPExcel\IOFactory::load(str_replace('.php', '.xlsx', __FILE__));
|
||||||
|
|
||||||
// Set properties
|
// Set properties
|
||||||
echo date('H:i:s') , " Get properties" , EOL;
|
echo date('H:i:s') , " Get properties" , EOL;
|
||||||
|
@ -106,9 +106,9 @@ foreach($customProperties as $customProperty) {
|
||||||
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
|
||||||
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
|
||||||
echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
|
echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
|
||||||
if ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE) {
|
if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) {
|
||||||
echo date('d-M-Y H:i:s',$propertyValue) , EOL;
|
echo date('d-M-Y H:i:s',$propertyValue) , EOL;
|
||||||
} elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
|
} elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
|
||||||
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
|
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
|
||||||
} else {
|
} else {
|
||||||
echo $propertyValue , EOL;
|
echo $propertyValue , EOL;
|
||||||
|
|
|
@ -10,37 +10,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/**
|
/** Include PHPExcel */
|
||||||
* PHPExcel
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
*
|
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
||||||
* @version ##VERSION##, ##DATE##
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Include path **/
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
|
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
|
||||||
include 'PHPExcel/IOFactory.php';
|
|
||||||
|
|
||||||
$inputFileType = 'Excel2007';
|
$inputFileType = 'Excel2007';
|
||||||
$inputFileNames = 'templates/32readwrite*[0-9].xlsx';
|
$inputFileNames = 'templates/32readwrite*[0-9].xlsx';
|
||||||
|
@ -63,7 +34,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objReader->setIncludeCharts(TRUE);
|
$objReader->setIncludeCharts(TRUE);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
@ -114,7 +85,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
$outputFileName = basename($inputFileName);
|
$outputFileName = basename($inputFileName);
|
||||||
|
|
||||||
echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
|
echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save($outputFileName);
|
$objWriter->save($outputFileName);
|
||||||
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -82,15 +82,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -98,16 +98,16 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test %age-Stacked Area Chart');
|
$title = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -128,7 +128,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -82,15 +82,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a horizontal bar rather than a vertical column graph
|
// Make it a horizontal bar rather than a vertical column graph
|
||||||
$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR);
|
$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_BAR);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Chart');
|
$title = new \PHPExcel\Chart\Title('Test Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -82,15 +82,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a horizontal bar rather than a vertical column graph
|
// Make it a horizontal bar rather than a vertical column graph
|
||||||
$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR);
|
$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_BAR);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Bar Chart');
|
$title = new \PHPExcel\Chart\Title('Test Bar Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -68,9 +68,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget'
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget'
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast'
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast'
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual'
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual'
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -80,7 +80,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -90,15 +90,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -106,20 +106,20 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
|
$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_BOTTOM, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_BOTTOM, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Grouped Column Chart');
|
$title = new \PHPExcel\Chart\Title('Test Grouped Column Chart');
|
||||||
$xAxisLabel = new PHPExcel_Chart_Title('Financial Period');
|
$xAxisLabel = new \PHPExcel\Chart\Title('Financial Period');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -140,7 +140,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -82,15 +82,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
|
$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Column Chart');
|
$title = new \PHPExcel\Chart\Title('Test Column Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -69,13 +69,13 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = array(
|
$dataSeriesLabels1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // Temperature
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // Temperature
|
||||||
);
|
);
|
||||||
$dataSeriesLabels2 = array(
|
$dataSeriesLabels2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall
|
||||||
);
|
);
|
||||||
$dataSeriesLabels3 = array(
|
$dataSeriesLabels3 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // Humidity
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // Humidity
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
|
@ -86,7 +86,7 @@ $dataSeriesLabels3 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,13 +98,13 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = array(
|
$dataSeriesValues1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', NULL, 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new PHPExcel_Chart_DataSeries(
|
$series1 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues1)-1), // plotOrder
|
range(0, count($dataSeriesValues1)-1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -112,7 +112,7 @@ $series1 = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series1->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
|
$series1->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
|
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
|
@ -123,13 +123,13 @@ $series1->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = array(
|
$dataSeriesValues2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new PHPExcel_Chart_DataSeries(
|
$series2 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2)-1), // plotOrder
|
range(0, count($dataSeriesValues2)-1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
NULL, // plotCategory
|
NULL, // plotCategory
|
||||||
|
@ -145,13 +145,13 @@ $series2 = new PHPExcel_Chart_DataSeries(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues3 = array(
|
$dataSeriesValues3 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series3 = new PHPExcel_Chart_DataSeries(
|
$series3 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2)-1), // plotOrder
|
range(0, count($dataSeriesValues2)-1), // plotOrder
|
||||||
$dataSeriesLabels3, // plotLabel
|
$dataSeriesLabels3, // plotLabel
|
||||||
NULL, // plotCategory
|
NULL, // plotCategory
|
||||||
|
@ -160,15 +160,15 @@ $series3 = new PHPExcel_Chart_DataSeries(
|
||||||
|
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series1, $series2, $series3));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series1, $series2, $series3));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Average Weather Chart for Crete');
|
$title = new \PHPExcel\Chart\Title('Average Weather Chart for Crete');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -189,7 +189,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -82,15 +82,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
|
@ -98,16 +98,16 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Stacked Line Chart');
|
$title = new \PHPExcel\Chart\Title('Test Stacked Line Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -128,7 +128,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -61,9 +61,9 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = array(
|
$dataSeriesLabels1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -73,7 +73,7 @@ $dataSeriesLabels1 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues1 = array(
|
$xAxisTickValues1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -83,15 +83,15 @@ $xAxisTickValues1 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = array(
|
$dataSeriesValues1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new PHPExcel_Chart_DataSeries(
|
$series1 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
|
||||||
range(0, count($dataSeriesValues1)-1), // plotOrder
|
range(0, count($dataSeriesValues1)-1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
$xAxisTickValues1, // plotCategory
|
$xAxisTickValues1, // plotCategory
|
||||||
|
@ -99,16 +99,16 @@ $series1 = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea1 = new PHPExcel_Chart_PlotArea(NULL, array($series1));
|
$plotArea1 = new \PHPExcel\Chart\PlotArea(NULL, array($series1));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend1 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
|
$legend1 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false);
|
||||||
|
|
||||||
$title1 = new PHPExcel_Chart_Title('Test %age-Stacked Area Chart');
|
$title1 = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart');
|
||||||
$yAxisLabel1 = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel1 = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart1 = new PHPExcel_Chart(
|
$chart1 = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title1, // title
|
$title1, // title
|
||||||
$legend1, // legend
|
$legend1, // legend
|
||||||
|
@ -135,9 +135,9 @@ $objWorksheet->addChart($chart1);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels2 = array(
|
$dataSeriesLabels2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -147,7 +147,7 @@ $dataSeriesLabels2 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues2 = array(
|
$xAxisTickValues2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -157,15 +157,15 @@ $xAxisTickValues2 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = array(
|
$dataSeriesValues2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new PHPExcel_Chart_DataSeries(
|
$series2 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
|
||||||
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
|
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
|
||||||
range(0, count($dataSeriesValues2)-1), // plotOrder
|
range(0, count($dataSeriesValues2)-1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
$xAxisTickValues2, // plotCategory
|
$xAxisTickValues2, // plotCategory
|
||||||
|
@ -173,19 +173,19 @@ $series2 = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
// Set additional dataseries parameters
|
// Set additional dataseries parameters
|
||||||
// Make it a vertical column rather than a horizontal bar graph
|
// Make it a vertical column rather than a horizontal bar graph
|
||||||
$series2->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
|
$series2->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea2 = new PHPExcel_Chart_PlotArea(NULL, array($series2));
|
$plotArea2 = new \PHPExcel\Chart\PlotArea(NULL, array($series2));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend2 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend2 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title2 = new PHPExcel_Chart_Title('Test Column Chart');
|
$title2 = new \PHPExcel\Chart\Title('Test Column Chart');
|
||||||
$yAxisLabel2 = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel2 = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart2 = new PHPExcel_Chart(
|
$chart2 = new \PHPExcel\Chart(
|
||||||
'chart2', // name
|
'chart2', // name
|
||||||
$title2, // title
|
$title2, // title
|
||||||
$legend2, // legend
|
$legend2, // legend
|
||||||
|
@ -206,7 +206,7 @@ $objWorksheet->addChart($chart2);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -61,7 +61,7 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels1 = array(
|
$dataSeriesLabels1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -71,7 +71,7 @@ $dataSeriesLabels1 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues1 = array(
|
$xAxisTickValues1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -81,12 +81,12 @@ $xAxisTickValues1 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues1 = array(
|
$dataSeriesValues1 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series1 = new PHPExcel_Chart_DataSeries(
|
$series1 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_PIECHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_PIECHART, // plotType
|
||||||
NULL, // plotGrouping (Pie charts don't have any grouping)
|
NULL, // plotGrouping (Pie charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues1)-1), // plotOrder
|
range(0, count($dataSeriesValues1)-1), // plotOrder
|
||||||
$dataSeriesLabels1, // plotLabel
|
$dataSeriesLabels1, // plotLabel
|
||||||
|
@ -95,20 +95,20 @@ $series1 = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout1 = new PHPExcel_Chart_Layout();
|
$layout1 = new \PHPExcel\Chart\Layout();
|
||||||
$layout1->setShowVal(TRUE);
|
$layout1->setShowVal(TRUE);
|
||||||
$layout1->setShowPercent(TRUE);
|
$layout1->setShowPercent(TRUE);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea1 = new PHPExcel_Chart_PlotArea($layout1, array($series1));
|
$plotArea1 = new \PHPExcel\Chart\PlotArea($layout1, array($series1));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend1 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend1 = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title1 = new PHPExcel_Chart_Title('Test Pie Chart');
|
$title1 = new \PHPExcel\Chart\Title('Test Pie Chart');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart1 = new PHPExcel_Chart(
|
$chart1 = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title1, // title
|
$title1, // title
|
||||||
$legend1, // legend
|
$legend1, // legend
|
||||||
|
@ -135,7 +135,7 @@ $objWorksheet->addChart($chart1);
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels2 = array(
|
$dataSeriesLabels2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -145,7 +145,7 @@ $dataSeriesLabels2 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues2 = array(
|
$xAxisTickValues2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -155,12 +155,12 @@ $xAxisTickValues2 = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues2 = array(
|
$dataSeriesValues2 = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series2 = new PHPExcel_Chart_DataSeries(
|
$series2 = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_DONUTCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_DONUTCHART, // plotType
|
||||||
NULL, // plotGrouping (Donut charts don't have any grouping)
|
NULL, // plotGrouping (Donut charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues2)-1), // plotOrder
|
range(0, count($dataSeriesValues2)-1), // plotOrder
|
||||||
$dataSeriesLabels2, // plotLabel
|
$dataSeriesLabels2, // plotLabel
|
||||||
|
@ -169,18 +169,18 @@ $series2 = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout2 = new PHPExcel_Chart_Layout();
|
$layout2 = new \PHPExcel\Chart\Layout();
|
||||||
$layout2->setShowVal(TRUE);
|
$layout2->setShowVal(TRUE);
|
||||||
$layout2->setShowCatName(TRUE);
|
$layout2->setShowCatName(TRUE);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea2 = new PHPExcel_Chart_PlotArea($layout2, array($series2));
|
$plotArea2 = new \PHPExcel\Chart\PlotArea($layout2, array($series2));
|
||||||
|
|
||||||
$title2 = new PHPExcel_Chart_Title('Test Donut Chart');
|
$title2 = new \PHPExcel\Chart\Title('Test Donut Chart');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart2 = new PHPExcel_Chart(
|
$chart2 = new \PHPExcel\Chart(
|
||||||
'chart2', // name
|
'chart2', // name
|
||||||
$title2, // title
|
$title2, // title
|
||||||
NULL, // legend
|
NULL, // legend
|
||||||
|
@ -201,7 +201,7 @@ $objWorksheet->addChart($chart2);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -69,8 +69,8 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -80,8 +80,8 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -91,35 +91,35 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_RADARCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_RADARCHART, // plotType
|
||||||
NULL, // plotGrouping (Radar charts don't have any grouping)
|
NULL, // plotGrouping (Radar charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
$dataSeriesValues, // plotValues
|
$dataSeriesValues, // plotValues
|
||||||
NULL, // smooth line
|
NULL, // smooth line
|
||||||
PHPExcel_Chart_DataSeries::STYLE_MARKER // plotStyle
|
\PHPExcel\Chart\DataSeries::STYLE_MARKER // plotStyle
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up a layout object for the Pie chart
|
// Set up a layout object for the Pie chart
|
||||||
$layout = new PHPExcel_Chart_Layout();
|
$layout = new \PHPExcel\Chart\Layout();
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea($layout, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea($layout, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Radar Chart');
|
$title = new \PHPExcel\Chart\Title('Test Radar Chart');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -140,7 +140,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -60,13 +60,13 @@ $objWorksheet->fromArray(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -76,34 +76,34 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
|
||||||
NULL, // plotGrouping (Scatter charts don't have any grouping)
|
NULL, // plotGrouping (Scatter charts don't have any grouping)
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
$xAxisTickValues, // plotCategory
|
$xAxisTickValues, // plotCategory
|
||||||
$dataSeriesValues, // plotValues
|
$dataSeriesValues, // plotValues
|
||||||
NULL, // smooth line
|
NULL, // smooth line
|
||||||
PHPExcel_Chart_DataSeries::STYLE_LINEMARKER // plotStyle
|
\PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_TOPRIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Scatter Chart');
|
$title = new \PHPExcel\Chart\Title('Test Scatter Chart');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
|
||||||
|
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'chart1', // name
|
'chart1', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -124,7 +124,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$objWorksheet = $objPHPExcel->getActiveSheet();
|
$objWorksheet = $objPHPExcel->getActiveSheet();
|
||||||
$objWorksheet->fromArray(
|
$objWorksheet->fromArray(
|
||||||
array(
|
array(
|
||||||
|
@ -52,7 +52,7 @@ $objWorksheet->fromArray(
|
||||||
array(100, 40, 5, 0, 50 ),
|
array(100, 40, 5, 0, 50 ),
|
||||||
), null, 'A1', true
|
), null, 'A1', true
|
||||||
);
|
);
|
||||||
$objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
|
$objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel\Style\NumberFormat::FORMAT_NUMBER_00);
|
||||||
|
|
||||||
|
|
||||||
// Set the Labels for each data series we want to plot
|
// Set the Labels for each data series we want to plot
|
||||||
|
@ -63,10 +63,10 @@ $objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel_Styl
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesLabels = array(
|
$dataSeriesLabels = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), //Max / Open
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), //Max / Open
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), //Min / Close
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), //Min / Close
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), //Min Threshold / Min
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), //Min Threshold / Min
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), //Max Threshold / Max
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), //Max Threshold / Max
|
||||||
);
|
);
|
||||||
// Set the X-Axis Labels
|
// Set the X-Axis Labels
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -76,7 +76,7 @@ $dataSeriesLabels = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$xAxisTickValues = array(
|
$xAxisTickValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$6', NULL, 5), // Counts
|
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', NULL, 5), // Counts
|
||||||
);
|
);
|
||||||
// Set the Data values for each data series we want to plot
|
// Set the Data values for each data series we want to plot
|
||||||
// Datatype
|
// Datatype
|
||||||
|
@ -86,15 +86,15 @@ $xAxisTickValues = array(
|
||||||
// Data values
|
// Data values
|
||||||
// Data Marker
|
// Data Marker
|
||||||
$dataSeriesValues = array(
|
$dataSeriesValues = array(
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', NULL, 5),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', NULL, 5),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', NULL, 5),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', NULL, 5),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', NULL, 5),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', NULL, 5),
|
||||||
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', NULL, 5),
|
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', NULL, 5),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build the dataseries
|
// Build the dataseries
|
||||||
$series = new PHPExcel_Chart_DataSeries(
|
$series = new \PHPExcel\Chart\DataSeries(
|
||||||
PHPExcel_Chart_DataSeries::TYPE_STOCKCHART, // plotType
|
\PHPExcel\Chart\DataSeries::TYPE_STOCKCHART, // plotType
|
||||||
null, // plotGrouping - if we set this to not null, then xlsx throws error
|
null, // plotGrouping - if we set this to not null, then xlsx throws error
|
||||||
range(0, count($dataSeriesValues)-1), // plotOrder
|
range(0, count($dataSeriesValues)-1), // plotOrder
|
||||||
$dataSeriesLabels, // plotLabel
|
$dataSeriesLabels, // plotLabel
|
||||||
|
@ -103,16 +103,16 @@ $series = new PHPExcel_Chart_DataSeries(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the series in the plot area
|
// Set the series in the plot area
|
||||||
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
|
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
|
||||||
// Set the chart legend
|
// Set the chart legend
|
||||||
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
|
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
|
||||||
|
|
||||||
$title = new PHPExcel_Chart_Title('Test Stock Chart');
|
$title = new \PHPExcel\Chart\Title('Test Stock Chart');
|
||||||
$xAxisLabel = new PHPExcel_Chart_Title('Counts');
|
$xAxisLabel = new \PHPExcel\Chart\Title('Counts');
|
||||||
$yAxisLabel = new PHPExcel_Chart_Title('Values');
|
$yAxisLabel = new \PHPExcel\Chart\Title('Values');
|
||||||
|
|
||||||
// Create the chart
|
// Create the chart
|
||||||
$chart = new PHPExcel_Chart(
|
$chart = new \PHPExcel\Chart(
|
||||||
'stock-chart', // name
|
'stock-chart', // name
|
||||||
$title, // title
|
$title, // title
|
||||||
$legend, // legend
|
$legend, // legend
|
||||||
|
@ -133,7 +133,7 @@ $objWorksheet->addChart($chart);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$filename = str_replace('.php', '.xlsx', __FILE__);
|
$filename = str_replace('.php', '.xlsx', __FILE__);
|
||||||
if(file_exists($filename)) {
|
if(file_exists($filename)) {
|
||||||
|
|
|
@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel */
|
/** PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
if (!file_exists("33chartcreate-bar.xlsx")) {
|
if (!file_exists("33chartcreate-bar.xlsx")) {
|
||||||
exit("Please run 33chartcreate-bar.php first." . EOL);
|
exit("Please run 33chartcreate-bar.php first." . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
|
||||||
$objReader = PHPExcel_IOFactory::createReader("Excel2007");
|
$objReader = \PHPExcel\IOFactory::createReader("Excel2007");
|
||||||
$objReader->setIncludeCharts(TRUE);
|
$objReader->setIncludeCharts(TRUE);
|
||||||
$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx");
|
$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx");
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ $objWorksheet->fromArray(
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
|
@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/**
|
/** PHPExcel */
|
||||||
* PHPExcel
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
*
|
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
||||||
* @version ##VERSION##, ##DATE##
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Include path **/
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
|
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
|
||||||
include 'PHPExcel/IOFactory.php';
|
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setChartRenderer(
|
if (!PHPExcel\Settings::setChartRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -83,7 +54,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objReader->setIncludeCharts(TRUE);
|
$objReader->setIncludeCharts(TRUE);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
|
@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/**
|
/** Include PHPExcel */
|
||||||
* PHPExcel
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
*
|
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
||||||
* @version ##VERSION##, ##DATE##
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Include path **/
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
|
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
|
||||||
include 'PHPExcel/IOFactory.php';
|
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// and its directory location on your server
|
// and its directory location on your server
|
||||||
$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setChartRenderer(
|
if (!PHPExcel\Settings::setChartRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -83,7 +54,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objReader->setIncludeCharts(TRUE);
|
$objReader->setIncludeCharts(TRUE);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
@ -134,7 +105,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
$outputFileName = str_replace('.xlsx', '.html', basename($inputFileName));
|
$outputFileName = str_replace('.xlsx', '.html', basename($inputFileName));
|
||||||
|
|
||||||
echo date('H:i:s') , " Write Tests to HTML file " , EOL;
|
echo date('H:i:s') , " Write Tests to HTML file " , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save($outputFileName);
|
$objWriter->save($outputFileName);
|
||||||
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
||||||
|
|
|
@ -10,51 +10,22 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/**
|
/** Include PHPExcel */
|
||||||
* PHPExcel
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
*
|
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* @category PHPExcel
|
|
||||||
* @package PHPExcel
|
|
||||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
||||||
* @version ##VERSION##, ##DATE##
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Include path **/
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
|
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
|
||||||
include 'PHPExcel/IOFactory.php';
|
|
||||||
|
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// for PDF files, and its directory location on your server
|
// for PDF files, and its directory location on your server
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
|
//$rendererName = PHPExcel\Settings::PDF_RENDERER_TCPDF;
|
||||||
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
|
$rendererName = PHPExcel\Settings::PDF_RENDERER_MPDF;
|
||||||
//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
|
//$rendererName = PHPExcel\Settings::PDF_RENDERER_DOMPDF;
|
||||||
//$rendererLibrary = 'tcPDF5.9';
|
//$rendererLibrary = 'tcPDF5.9';
|
||||||
$rendererLibrary = 'mPDF5.4';
|
$rendererLibrary = 'mPDF5.4';
|
||||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||||
|
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setPdfRenderer(
|
if (!PHPExcel\Settings::setPdfRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -68,12 +39,12 @@ if (!PHPExcel_Settings::setPdfRenderer(
|
||||||
|
|
||||||
// Change these values to select the Rendering library that you wish to use
|
// Change these values to select the Rendering library that you wish to use
|
||||||
// for Chart images, and its directory location on your server
|
// for Chart images, and its directory location on your server
|
||||||
$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
|
$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH;
|
||||||
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
$rendererLibrary = 'jpgraph3.5.0b1/src/';
|
||||||
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
|
||||||
|
|
||||||
|
|
||||||
if (!PHPExcel_Settings::setChartRenderer(
|
if (!PHPExcel\Settings::setChartRenderer(
|
||||||
$rendererName,
|
$rendererName,
|
||||||
$rendererLibraryPath
|
$rendererLibraryPath
|
||||||
)) {
|
)) {
|
||||||
|
@ -106,7 +77,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
|
|
||||||
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$objReader->setIncludeCharts(TRUE);
|
$objReader->setIncludeCharts(TRUE);
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
@ -157,7 +128,7 @@ foreach($inputFileNames as $inputFileName) {
|
||||||
$outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName));
|
$outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName));
|
||||||
|
|
||||||
echo date('H:i:s') , " Write Tests to HTML file " , EOL;
|
echo date('H:i:s') , " Write Tests to HTML file " , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
|
||||||
$objWriter->setIncludeCharts(TRUE);
|
$objWriter->setIncludeCharts(TRUE);
|
||||||
$objWriter->save($outputFileName);
|
$objWriter->save($outputFileName);
|
||||||
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
echo date('H:i:s') , " File written to " , $outputFileName , EOL;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -62,16 +62,16 @@ $objPHPExcel->setActiveSheetIndex(0)
|
||||||
$objPHPExcel->setActiveSheetIndex(0);
|
$objPHPExcel->setActiveSheetIndex(0);
|
||||||
|
|
||||||
// Set the page layout view as page layout
|
// Set the page layout view as page layout
|
||||||
$objPHPExcel->getActiveSheet()->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT);
|
$objPHPExcel->getActiveSheet()->getSheetView()->setView(PHPExcel\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT);
|
||||||
|
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
// Save Excel5 file
|
// Save Excel5 file
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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 date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -99,7 +99,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
|
||||||
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Create new PHPExcel object
|
// 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();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
|
|
||||||
// Set document properties
|
// Set document properties
|
||||||
echo date('H:i:s') , " Set document properties" , EOL;
|
echo date('H:i:s') , " Set document properties" , EOL;
|
||||||
|
@ -74,7 +74,7 @@ foreach(glob('./data/continents/*') as $key => $filename) {
|
||||||
$objPHPExcel->getActiveSheet()
|
$objPHPExcel->getActiveSheet()
|
||||||
->fromArray($countries, null, $column . '1');
|
->fromArray($countries, null, $column . '1');
|
||||||
$objPHPExcel->addNamedRange(
|
$objPHPExcel->addNamedRange(
|
||||||
new PHPExcel_NamedRange(
|
new PHPExcel\NamedRange(
|
||||||
$continent,
|
$continent,
|
||||||
$objPHPExcel->getActiveSheet(), $column . '1:' . $column . $countryCount
|
$objPHPExcel->getActiveSheet(), $column . '1:' . $column . $countryCount
|
||||||
)
|
)
|
||||||
|
@ -95,7 +95,7 @@ $objPHPExcel->getActiveSheet()
|
||||||
->setVisible(false);
|
->setVisible(false);
|
||||||
|
|
||||||
$objPHPExcel->addNamedRange(
|
$objPHPExcel->addNamedRange(
|
||||||
new PHPExcel_NamedRange(
|
new PHPExcel\NamedRange(
|
||||||
'Continents',
|
'Continents',
|
||||||
$objPHPExcel->getActiveSheet(), $continentColumn . '1:' . $continentColumn . ($key+1)
|
$objPHPExcel->getActiveSheet(), $continentColumn . '1:' . $continentColumn . ($key+1)
|
||||||
)
|
)
|
||||||
|
@ -119,8 +119,8 @@ $objPHPExcel->getActiveSheet()
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()
|
$objValidation = $objPHPExcel->getActiveSheet()
|
||||||
->getCell('B1')
|
->getCell('B1')
|
||||||
->getDataValidation();
|
->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
|
$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST )
|
||||||
->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
|
->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION )
|
||||||
->setAllowBlank(false)
|
->setAllowBlank(false)
|
||||||
->setShowInputMessage(true)
|
->setShowInputMessage(true)
|
||||||
->setShowErrorMessage(true)
|
->setShowErrorMessage(true)
|
||||||
|
@ -140,8 +140,8 @@ $objPHPExcel->getActiveSheet()
|
||||||
$objValidation = $objPHPExcel->getActiveSheet()
|
$objValidation = $objPHPExcel->getActiveSheet()
|
||||||
->getCell('B3')
|
->getCell('B3')
|
||||||
->getDataValidation();
|
->getDataValidation();
|
||||||
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
|
$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST )
|
||||||
->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
|
->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION )
|
||||||
->setAllowBlank(false)
|
->setAllowBlank(false)
|
||||||
->setShowInputMessage(true)
|
->setShowInputMessage(true)
|
||||||
->setShowErrorMessage(true)
|
->setShowErrorMessage(true)
|
||||||
|
@ -163,7 +163,7 @@ $objPHPExcel->setActiveSheetIndex(0);
|
||||||
// Save Excel 2007 file
|
// Save Excel 2007 file
|
||||||
// This linked validation list method only seems to work for Excel2007, not for Excel5
|
// This linked validation list method only seems to work for Excel2007, not for Excel5
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new \PHPExcel\Spreadsheet();
|
||||||
$worksheet = $objPHPExcel->getActiveSheet();
|
$worksheet = $objPHPExcel->getActiveSheet();
|
||||||
|
|
||||||
echo date('H:i:s') , " Create styles array" , EOL;
|
echo date('H:i:s') , " Create styles array" , EOL;
|
||||||
$styles = array();
|
$styles = array();
|
||||||
for ($i = 0; $i < 10; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$style = new PHPExcel_Style();
|
$style = new \PHPExcel\Style();
|
||||||
$style->getFont()->setSize($i + 4);
|
$style->getFont()->setSize($i + 4);
|
||||||
$styles[] = $style;
|
$styles[] = $style;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ for ($col = 0; $col < 50; $col++) {
|
||||||
for ($row = 0; $row < 100; $row++) {
|
for ($row = 0; $row < 100; $row++) {
|
||||||
$str = ($row + $col);
|
$str = ($row + $col);
|
||||||
$style = $styles[$row % 10];
|
$style = $styles[$row % 10];
|
||||||
$coord = PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1);
|
$coord = \PHPExcel\Cell::stringFromColumnIndex($col) . ($row + 1);
|
||||||
$worksheet->setCellValue($coord, $str);
|
$worksheet->setCellValue($coord, $str);
|
||||||
$worksheet->duplicateStyle($style, $coord);
|
$worksheet->duplicateStyle($style, $coord);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ echo date('H:i:s') , " Add data (end), time: " . round($d, 2) . " s", EOL;
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
include "05featuredemo.inc.php";
|
include "05featuredemo.inc.php";
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
// Set password against the spreadsheet file
|
// Set password against the spreadsheet file
|
||||||
|
@ -50,7 +50,7 @@ $objPHPExcel->getSecurity()->setWorkbookPassword('secret');
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -65,7 +65,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
|
|
@ -33,14 +33,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel1 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx");
|
$objPHPExcel1 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx");
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -52,7 +52,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
echo date('H:i:s') , " Load MergeBook2 from Excel2007 file" , EOL;
|
echo date('H:i:s') , " Load MergeBook2 from Excel2007 file" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objPHPExcel2 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx");
|
$objPHPExcel2 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx");
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
$callTime = $callEndTime - $callStartTime;
|
$callTime = $callEndTime - $callStartTime;
|
||||||
|
@ -71,7 +71,7 @@ foreach($objPHPExcel2->getSheetNames() as $sheetName) {
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel1, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel1, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
||||||
|
|
||||||
$callEndTime = microtime(true);
|
$callEndTime = microtime(true);
|
||||||
|
|
|
@ -33,17 +33,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** Include PHPExcel_IOFactory */
|
/** Include PHPExcel */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists("05featuredemo.xlsx")) {
|
if (!file_exists("05featuredemo.xlsx")) {
|
||||||
exit("Please run 05featuredemo.php first." . EOL);
|
exit("Please run 05featuredemo.php first." . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$inputFileName = "05featuredemo.xlsx";
|
$inputFileName = "05featuredemo.xlsx";
|
||||||
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
|
$inputFileType = \PHPExcel\IOFactory::identify($inputFileName);
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
$sheetList = $objReader->listWorksheetNames($inputFileName);
|
$sheetList = $objReader->listWorksheetNames($inputFileName);
|
||||||
$sheetInfo = $objReader->listWorksheetInfo($inputFileName);
|
$sheetInfo = $objReader->listWorksheetInfo($inputFileName);
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,14 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Excel2003XML file" , PHP_EOL;
|
echo date('H:i:s') , " Load from Excel2003XML file" , PHP_EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Excel2003XML');
|
$objReader = \PHPExcel\IOFactory::createReader('Excel2003XML');
|
||||||
$objPHPExcel = $objReader->load("Excel2003XMLTest.xml");
|
$objPHPExcel = $objReader->load("Excel2003XMLTest.xml");
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||||
$objWriter->save(str_replace('.php', '.xls', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from Gnumeric file" , PHP_EOL;
|
echo date('H:i:s') , " Load from Gnumeric file" , PHP_EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader('Gnumeric');
|
$objReader = \PHPExcel\IOFactory::createReader('Gnumeric');
|
||||||
$objPHPExcel = $objReader->load("GnumericTest.gnumeric");
|
$objPHPExcel = $objReader->load("GnumericTest.gnumeric");
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
|
echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader('OOCalc');
|
$objReader = \PHPExcel\IOFactory::createReader('OOCalc');
|
||||||
$objPHPExcel = $objReader->load("OOCalcTest.ods");
|
$objPHPExcel = $objReader->load("OOCalcTest.ods");
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,16 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
|
||||||
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
|
PHPExcel\Settings::setZipClass(PHPExcel\Settings::PCLZIP);
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
|
echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
|
||||||
$callStartTime = microtime(true);
|
$callStartTime = microtime(true);
|
||||||
|
|
||||||
$objReader = PHPExcel_IOFactory::createReader('OOCalc');
|
$objReader = \PHPExcel\IOFactory::createReader('OOCalc');
|
||||||
$objPHPExcel = $objReader->load("OOCalcTest.ods");
|
$objPHPExcel = $objReader->load("OOCalcTest.ods");
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ if (isset($_POST['submit'])) {
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
/** Load the quadratic equation solver worksheet into memory **/
|
/** Load the quadratic equation solver worksheet into memory **/
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load('./Quadratic.xlsx');
|
$objPHPExcel = \PHPExcel\IOFactory::load('./Quadratic.xlsx');
|
||||||
|
|
||||||
/** Set our A, B and C values **/
|
/** Set our A, B and C values **/
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue('A1', $_POST['A']);
|
$objPHPExcel->getActiveSheet()->setCellValue('A1', $_POST['A']);
|
||||||
|
|
|
@ -30,15 +30,15 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Load from SYLK file" , PHP_EOL;
|
echo date('H:i:s') , " Load from SYLK file" , PHP_EOL;
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load("SylkTest.slk");
|
$objPHPExcel = \PHPExcel\IOFactory::load("SylkTest.slk");
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ error_reporting(E_ALL);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/London');
|
date_default_timezone_set('Europe/London');
|
||||||
|
|
||||||
/** PHPExcel_IOFactory */
|
/** \PHPExcel\IOFactory */
|
||||||
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,17 +38,17 @@ echo date('H:i:s') , " Load from XML file" , PHP_EOL;
|
||||||
$inputFileName = "XMLTest.xml";
|
$inputFileName = "XMLTest.xml";
|
||||||
|
|
||||||
/** Identify the type of $inputFileName **/
|
/** Identify the type of $inputFileName **/
|
||||||
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
|
$inputFileType = \PHPExcel\IOFactory::identify($inputFileName);
|
||||||
echo 'Loading ' , $inputFileName , ' using ' , $inputFileType , " Reader" , PHP_EOL;
|
echo 'Loading ' , $inputFileName , ' using ' , $inputFileType , " Reader" , PHP_EOL;
|
||||||
|
|
||||||
/** Create a new Reader of the type that has been identified **/
|
/** Create a new Reader of the type that has been identified **/
|
||||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
|
||||||
/** Load $inputFileName to a PHPExcel Object **/
|
/** Load $inputFileName to a PHPExcel Object **/
|
||||||
$objPHPExcel = $objReader->load($inputFileName);
|
$objPHPExcel = $objReader->load($inputFileName);
|
||||||
|
|
||||||
|
|
||||||
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
|
||||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||||
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
|
$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', __FILE__) , PHP_EOL;
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ class SQLite3 extends CacheBase implements ICache
|
||||||
$this->TableName = str_replace('.', '_', $this->getUniqueID());
|
$this->TableName = str_replace('.', '_', $this->getUniqueID());
|
||||||
$_DBName = ':memory:';
|
$_DBName = ':memory:';
|
||||||
|
|
||||||
$this->DBHandle = new SQLite3($_DBName);
|
$this->DBHandle = new \SQLite3($_DBName);
|
||||||
if ($this->DBHandle === false) {
|
if ($this->DBHandle === false) {
|
||||||
throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg());
|
throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2093,7 +2093,7 @@ class Calculation
|
||||||
public static function getInstance(Spreadsheet $spreadsheet = null)
|
public static function getInstance(Spreadsheet $spreadsheet = null)
|
||||||
{
|
{
|
||||||
if ($spreadsheet !== null) {
|
if ($spreadsheet !== null) {
|
||||||
$instance = $workbook->getCalculationEngine();
|
$instance = $spreadsheet->getCalculationEngine();
|
||||||
if (isset($instance)) {
|
if (isset($instance)) {
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ class IOFactory
|
||||||
{
|
{
|
||||||
$reader = self::createReaderForFile($pFilename);
|
$reader = self::createReaderForFile($pFilename);
|
||||||
$className = get_class($reader);
|
$className = get_class($reader);
|
||||||
$classType = explode('_', $className);
|
$classType = explode('\\', $className);
|
||||||
unset($reader);
|
unset($reader);
|
||||||
return array_pop($classType);
|
return array_pop($classType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace PHPExcel;
|
namespace PHPExcel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_NamedRange
|
* PHPExcel\NamedRange
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2015 PHPExcel
|
* Copyright (c) 2006 - 2015 PHPExcel
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel\Reader;
|
namespace PHPExcel\Reader;
|
||||||
|
use PHPExcel\Spreadsheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Reader_CSV
|
* PHPExcel_Reader_CSV
|
||||||
|
@ -235,7 +236,7 @@ class CSV extends BaseReader implements IReader
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, Spreadsheet $objPHPExcel)
|
||||||
{
|
{
|
||||||
$lineEnding = ini_get('auto_detect_line_endings');
|
$lineEnding = ini_get('auto_detect_line_endings');
|
||||||
ini_set('auto_detect_line_endings', true);
|
ini_set('auto_detect_line_endings', true);
|
||||||
|
|
|
@ -225,7 +225,7 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
|
|
||||||
$fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
$fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
||||||
|
|
||||||
$xml = new XMLReader();
|
$xml = new \XMLReader();
|
||||||
$res = $xml->xml(
|
$res = $xml->xml(
|
||||||
$this->securityScanFile(
|
$this->securityScanFile(
|
||||||
'zip://'.\PHPExcel\Shared\File::realpath($pFilename).'#'."$dir/$fileWorksheet"
|
'zip://'.\PHPExcel\Shared\File::realpath($pFilename).'#'."$dir/$fileWorksheet"
|
||||||
|
@ -237,12 +237,12 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
|
|
||||||
$currCells = 0;
|
$currCells = 0;
|
||||||
while ($xml->read()) {
|
while ($xml->read()) {
|
||||||
if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) {
|
if ($xml->name == 'row' && $xml->nodeType == \XMLReader::ELEMENT) {
|
||||||
$row = $xml->getAttribute('r');
|
$row = $xml->getAttribute('r');
|
||||||
$tmpInfo['totalRows'] = $row;
|
$tmpInfo['totalRows'] = $row;
|
||||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||||
$currCells = 0;
|
$currCells = 0;
|
||||||
} elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) {
|
} elseif ($xml->name == 'c' && $xml->nodeType == \XMLReader::ELEMENT) {
|
||||||
$currCells++;
|
$currCells++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,11 +344,11 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
|
|
||||||
// Apache POI fixes
|
// Apache POI fixes
|
||||||
$contents = $archive->getFromIndex(
|
$contents = $archive->getFromIndex(
|
||||||
$archive->locateName($fileName, ZIPARCHIVE::FL_NOCASE)
|
$archive->locateName($fileName, \ZipArchive::FL_NOCASE)
|
||||||
);
|
);
|
||||||
if ($contents === false) {
|
if ($contents === false) {
|
||||||
$contents = $archive->getFromIndex(
|
$contents = $archive->getFromIndex(
|
||||||
$archive->locateName(substr($fileName, 1), ZIPARCHIVE::FL_NOCASE)
|
$archive->locateName(substr($fileName, 1), \ZipArchive::FL_NOCASE)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1560,7 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
$this->getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")
|
$this->getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")
|
||||||
),
|
),
|
||||||
'SimpleXMLElement',
|
'SimpleXMLElement',
|
||||||
\PHPExcel|Settings::getLibXmlLoaderOptions()
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
);
|
);
|
||||||
$images = array();
|
$images = array();
|
||||||
|
|
||||||
|
@ -1654,9 +1654,9 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
$objDrawing->setResizeProportional(false);
|
$objDrawing->setResizeProportional(false);
|
||||||
|
|
||||||
if ($xfrm) {
|
if ($xfrm) {
|
||||||
$objDrawing->setWidth(\PHPExcel\Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cx")));
|
$objDrawing->setWidth(\PHPExcel\Shared\Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cx")));
|
||||||
$objDrawing->setHeight(\PHPExcel\Shared_Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cy")));
|
$objDrawing->setHeight(\PHPExcel\Shared\Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), "cy")));
|
||||||
$objDrawing->setRotation(\PHPExcel\Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
|
$objDrawing->setRotation(\PHPExcel\Shared\Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
|
||||||
}
|
}
|
||||||
if ($outerShdw) {
|
if ($outerShdw) {
|
||||||
$shadow = $objDrawing->getShadow();
|
$shadow = $objDrawing->getShadow();
|
||||||
|
@ -1670,12 +1670,12 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
}
|
}
|
||||||
$objDrawing->setWorksheet($docSheet);
|
$objDrawing->setWorksheet($docSheet);
|
||||||
} elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
} elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) {
|
||||||
$fromCoordinate = PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
|
$fromCoordinate = \PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
|
||||||
$fromOffsetX = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
$fromOffsetX = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
||||||
$fromOffsetY = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
$fromOffsetY = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
||||||
$toCoordinate = PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
|
$toCoordinate = \PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
|
||||||
$toOffsetX = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->colOff);
|
$toOffsetX = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->colOff);
|
||||||
$toOffsetY = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
|
$toOffsetY = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
|
||||||
$graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
|
$graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
|
||||||
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
|
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
|
||||||
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||||
|
@ -1875,7 +1875,7 @@ class Excel2007 extends BaseReader implements IReader
|
||||||
'SimpleXMLElement',
|
'SimpleXMLElement',
|
||||||
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
);
|
);
|
||||||
$objChart = \PHPExcel\Reader\Excel2007_Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
|
$objChart = \PHPExcel\Reader\Excel2007\Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
|
||||||
|
|
||||||
// echo 'Chart ', $chartEntryRef, '<br />';
|
// echo 'Chart ', $chartEntryRef, '<br />';
|
||||||
// var_dump($charts[$chartEntryRef]);
|
// var_dump($charts[$chartEntryRef]);
|
||||||
|
|
|
@ -615,7 +615,7 @@ class Excel5 extends BaseReader implements IReader
|
||||||
$this->loadOLE($pFilename);
|
$this->loadOLE($pFilename);
|
||||||
|
|
||||||
// Initialisations
|
// Initialisations
|
||||||
$this->phpExcel = new PHPExcel;
|
$this->phpExcel = new \PHPExcel\Spreadsheet();
|
||||||
$this->phpExcel->removeSheetByIndex(0); // remove 1st sheet
|
$this->phpExcel->removeSheetByIndex(0); // remove 1st sheet
|
||||||
if (!$this->readDataOnly) {
|
if (!$this->readDataOnly) {
|
||||||
$this->phpExcel->removeCellStyleXfByIndex(0); // remove the default style
|
$this->phpExcel->removeCellStyleXfByIndex(0); // remove the default style
|
||||||
|
|
|
@ -300,7 +300,7 @@ class Escher
|
||||||
$blipData = substr($recordData, 36 + $cbName);
|
$blipData = substr($recordData, 36 + $cbName);
|
||||||
|
|
||||||
// record is a container, read contents
|
// record is a container, read contents
|
||||||
$reader = new \PHPExcel\Reader\Excel5_Escher($BSE);
|
$reader = new \PHPExcel\Reader\Excel5\Escher($BSE);
|
||||||
$reader->load($blipData);
|
$reader->load($blipData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ class Escher
|
||||||
$this->pos += 8 + $length;
|
$this->pos += 8 + $length;
|
||||||
|
|
||||||
// record is a container, read contents
|
// record is a container, read contents
|
||||||
$dgContainer = new \PHPExcel\Shared_Escher\DgContainer();
|
$dgContainer = new \PHPExcel\Shared\Escher\DgContainer();
|
||||||
$this->object->setDgContainer($dgContainer);
|
$this->object->setDgContainer($dgContainer);
|
||||||
$reader = new \PHPExcel\Reader\Excel5\Escher($dgContainer);
|
$reader = new \PHPExcel\Reader\Excel5\Escher($dgContainer);
|
||||||
$escher = $reader->load($recordData);
|
$escher = $reader->load($recordData);
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Escher
|
||||||
/**
|
/**
|
||||||
* Drawing Group Container
|
* Drawing Group Container
|
||||||
*
|
*
|
||||||
* @var Escher\DggContainer
|
* @var \DggContainer
|
||||||
*/
|
*/
|
||||||
private $dggContainer;
|
private $dggContainer;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace \PHPExcel\Shared\Escher;
|
namespace PHPExcel\Shared\Escher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Escher_DgContainer
|
* PHPExcel_Shared_Escher_DgContainer
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace \PHPExcel\Shared\Escher;
|
namespace PHPExcel\Shared\Escher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Escher_DggContainer
|
* PHPExcel_Shared_Escher_DggContainer
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace \PHPExcel\Shared\Escher\DggContainer\BstoreContainer;
|
namespace PHPExcel\Shared\Escher\DggContainer\BstoreContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace \PHPExcel\Shared\Escher\DggContainer\BstoreContainer\BSE;
|
namespace PHPExcel\Shared\Escher\DggContainer\BstoreContainer\BSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
|
|
|
@ -1506,7 +1506,7 @@ class Worksheet implements IComparable
|
||||||
*
|
*
|
||||||
* Please note that this will overwrite existing cell styles for cells in range!
|
* Please note that this will overwrite existing cell styles for cells in range!
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated duplicateStyle
|
||||||
* @param Style $pSharedCellStyle Cell style to share
|
* @param Style $pSharedCellStyle Cell style to share
|
||||||
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
|
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
namespace PHPExcel\Writer\Excel2007;
|
namespace PHPExcel\Writer\Excel2007;
|
||||||
|
use PHPExcel\Chart\Axis;
|
||||||
|
use PHPExcel\Chart\DataSeries;
|
||||||
|
use PHPExcel\Chart\DataSeriesValues;
|
||||||
|
use PHPExcel\Chart\GridLines;
|
||||||
|
use PHPExcel\Chart\Layout;
|
||||||
|
use PHPExcel\Chart\Legend;
|
||||||
|
use PHPExcel\Chart\PlotArea;
|
||||||
|
use PHPExcel\Chart\Title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Writer_Excel2007_Chart
|
* PHPExcel_Writer_Excel2007_Chart
|
||||||
|
@ -33,12 +41,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write charts to XML format
|
* Write charts to XML format
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart $pChart
|
* @param \PHPExcel\Chart $pChart
|
||||||
*
|
*
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function writeChart(PHPExcel_Chart $pChart = null, $calculateCellValues = true)
|
public function writeChart(\PHPExcel\Chart $pChart = null, $calculateCellValues = true)
|
||||||
{
|
{
|
||||||
$this->calculateCellValues = $calculateCellValues;
|
$this->calculateCellValues = $calculateCellValues;
|
||||||
|
|
||||||
|
@ -112,12 +120,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Title
|
* Write Chart Title
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_Title $title
|
* @param Title $title
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
|
private function writeTitle(Title $title = null, $objWriter)
|
||||||
{
|
{
|
||||||
if (is_null($title)) {
|
if (is_null($title)) {
|
||||||
return;
|
return;
|
||||||
|
@ -157,12 +165,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Legend
|
* Write Chart Legend
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_Legend $legend
|
* @param Legend $legend
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
|
private function writeLegend(Legend $legend = null, $objWriter)
|
||||||
{
|
{
|
||||||
if (is_null($legend)) {
|
if (is_null($legend)) {
|
||||||
return;
|
return;
|
||||||
|
@ -208,16 +216,16 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Chart Plot Area
|
* Write Chart Plot Area
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_PlotArea $plotArea
|
* @param PlotArea $plotArea
|
||||||
* @param PHPExcel_Chart_Title $xAxisLabel
|
* @param Title $xAxisLabel
|
||||||
* @param PHPExcel_Chart_Title $yAxisLabel
|
* @param Title $yAxisLabel
|
||||||
* @param PHPExcel_Chart_Axis $xAxis
|
* @param Axis $xAxis
|
||||||
* @param PHPExcel_Chart_Axis $yAxis
|
* @param Axis $yAxis
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, \PHPExcel\Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
|
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis, Axis $yAxis, GridLines $majorGridlines, GridLines $minorGridlines)
|
||||||
{
|
{
|
||||||
if (is_null($plotArea)) {
|
if (is_null($plotArea)) {
|
||||||
return;
|
return;
|
||||||
|
@ -243,11 +251,11 @@ class Chart extends WriterPart
|
||||||
$groupType = $plotGroup->getPlotType();
|
$groupType = $plotGroup->getPlotType();
|
||||||
if ($groupType == $chartType) {
|
if ($groupType == $chartType) {
|
||||||
$plotStyle = $plotGroup->getPlotStyle();
|
$plotStyle = $plotGroup->getPlotStyle();
|
||||||
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
|
if ($groupType === DataSeries::TYPE_RADARCHART) {
|
||||||
$objWriter->startElement('c:radarStyle');
|
$objWriter->startElement('c:radarStyle');
|
||||||
$objWriter->writeAttribute('val', $plotStyle);
|
$objWriter->writeAttribute('val', $plotStyle);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
} elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
|
} elseif ($groupType === DataSeries::TYPE_SCATTERCHART) {
|
||||||
$objWriter->startElement('c:scatterStyle');
|
$objWriter->startElement('c:scatterStyle');
|
||||||
$objWriter->writeAttribute('val', $plotStyle);
|
$objWriter->writeAttribute('val', $plotStyle);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -259,13 +267,13 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
$this->writeDataLabels($objWriter, $layout);
|
$this->writeDataLabels($objWriter, $layout);
|
||||||
|
|
||||||
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
|
if ($chartType === DataSeries::TYPE_LINECHART) {
|
||||||
// Line only, Line3D can't be smoothed
|
// Line only, Line3D can't be smoothed
|
||||||
|
|
||||||
$objWriter->startElement('c:smooth');
|
$objWriter->startElement('c:smooth');
|
||||||
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
|
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
|
} elseif (($chartType === DataSeries::TYPE_BARCHART) ||($chartType === DataSeries::TYPE_BARCHART_3D)) {
|
||||||
$objWriter->startElement('c:gapWidth');
|
$objWriter->startElement('c:gapWidth');
|
||||||
$objWriter->writeAttribute('val', 150);
|
$objWriter->writeAttribute('val', 150);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -275,7 +283,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->writeAttribute('val', 100);
|
$objWriter->writeAttribute('val', 100);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
} elseif ($chartType === DataSeries::TYPE_BUBBLECHART) {
|
||||||
$objWriter->startElement('c:bubbleScale');
|
$objWriter->startElement('c:bubbleScale');
|
||||||
$objWriter->writeAttribute('val', 25);
|
$objWriter->writeAttribute('val', 25);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -283,7 +291,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->startElement('c:showNegBubbles');
|
$objWriter->startElement('c:showNegBubbles');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
|
} elseif ($chartType === DataSeries::TYPE_STOCKCHART) {
|
||||||
$objWriter->startElement('c:hiLowLines');
|
$objWriter->startElement('c:hiLowLines');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
|
@ -310,7 +318,7 @@ class Chart extends WriterPart
|
||||||
$id1 = '75091328';
|
$id1 = '75091328';
|
||||||
$id2 = '75089408';
|
$id2 = '75089408';
|
||||||
|
|
||||||
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) {
|
||||||
$objWriter->startElement('c:axId');
|
$objWriter->startElement('c:axId');
|
||||||
$objWriter->writeAttribute('val', $id1);
|
$objWriter->writeAttribute('val', $id1);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -322,7 +330,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
|
if ($chartType === DataSeries::TYPE_DONUTCHART) {
|
||||||
$objWriter->startElement('c:holeSize');
|
$objWriter->startElement('c:holeSize');
|
||||||
$objWriter->writeAttribute('val', 50);
|
$objWriter->writeAttribute('val', 50);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -332,8 +340,8 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) {
|
||||||
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
if ($chartType === DataSeries::TYPE_BUBBLECHART) {
|
||||||
$this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
|
$this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
|
||||||
} else {
|
} else {
|
||||||
$this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis);
|
$this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis);
|
||||||
|
@ -399,7 +407,7 @@ class Chart extends WriterPart
|
||||||
* Write Category Axis
|
* Write Category Axis
|
||||||
*
|
*
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
* @param PHPExcel_Chart_PlotArea $plotArea
|
* @param PlotArea $plotArea
|
||||||
* @param PHPExcel_Chart_Title $xAxisLabel
|
* @param PHPExcel_Chart_Title $xAxisLabel
|
||||||
* @param string $groupType Chart type
|
* @param string $groupType Chart type
|
||||||
* @param string $id1
|
* @param string $id1
|
||||||
|
@ -408,7 +416,7 @@ class Chart extends WriterPart
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeCategoryAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
|
private function writeCategoryAxis($objWriter, PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
|
||||||
{
|
{
|
||||||
$objWriter->startElement('c:catAx');
|
$objWriter->startElement('c:catAx');
|
||||||
|
|
||||||
|
@ -530,7 +538,7 @@ class Chart extends WriterPart
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeValueAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
|
private function writeValueAxis($objWriter, PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
|
||||||
{
|
{
|
||||||
$objWriter->startElement('c:valAx');
|
$objWriter->startElement('c:valAx');
|
||||||
|
|
||||||
|
@ -809,7 +817,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
if ($groupType !== DataSeries::TYPE_BUBBLECHART) {
|
||||||
$layout = $yAxisLabel->getLayout();
|
$layout = $yAxisLabel->getLayout();
|
||||||
$this->writeLayout($layout, $objWriter);
|
$this->writeLayout($layout, $objWriter);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +1001,7 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isMultiLevelSeries) {
|
if ($isMultiLevelSeries) {
|
||||||
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
if ($groupType !== DataSeries::TYPE_BUBBLECHART) {
|
||||||
$objWriter->startElement('c:noMultiLvlLbl');
|
$objWriter->startElement('c:noMultiLvlLbl');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -1034,7 +1042,7 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Plot Group (series of related plots)
|
* Write Plot Group (series of related plots)
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_DataSeries $plotGroup
|
* @param DataSeries $plotGroup
|
||||||
* @param string $groupType Type of plot for dataseries
|
* @param string $groupType Type of plot for dataseries
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
* @param boolean &$catIsMultiLevelSeries Is category a multi-series category
|
* @param boolean &$catIsMultiLevelSeries Is category a multi-series category
|
||||||
|
@ -1050,7 +1058,7 @@ class Chart extends WriterPart
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
|
if (($groupType == DataSeries::TYPE_BARCHART) || ($groupType == DataSeries::TYPE_BARCHART_3D)) {
|
||||||
$objWriter->startElement('c:barDir');
|
$objWriter->startElement('c:barDir');
|
||||||
$objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
|
$objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -1067,9 +1075,9 @@ class Chart extends WriterPart
|
||||||
$plotSeriesOrder = $plotGroup->getPlotOrder();
|
$plotSeriesOrder = $plotGroup->getPlotOrder();
|
||||||
$plotSeriesCount = count($plotSeriesOrder);
|
$plotSeriesCount = count($plotSeriesOrder);
|
||||||
|
|
||||||
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
|
if (($groupType !== DataSeries::TYPE_RADARCHART) && ($groupType !== DataSeries::TYPE_STOCKCHART)) {
|
||||||
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
|
if ($groupType !== DataSeries::TYPE_LINECHART) {
|
||||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
|
if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
|
||||||
$objWriter->startElement('c:varyColors');
|
$objWriter->startElement('c:varyColors');
|
||||||
$objWriter->writeAttribute('val', 1);
|
$objWriter->writeAttribute('val', 1);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -1092,7 +1100,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
|
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) {
|
||||||
$objWriter->startElement('c:dPt');
|
$objWriter->startElement('c:dPt');
|
||||||
$objWriter->startElement('c:idx');
|
$objWriter->startElement('c:idx');
|
||||||
$objWriter->writeAttribute('val', 3);
|
$objWriter->writeAttribute('val', 3);
|
||||||
|
@ -1123,11 +1131,11 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formatting for the points
|
// Formatting for the points
|
||||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
|
if (($groupType == DataSeries::TYPE_LINECHART) || ($groupType == DataSeries::TYPE_STOCKCHART)) {
|
||||||
$objWriter->startElement('c:spPr');
|
$objWriter->startElement('c:spPr');
|
||||||
$objWriter->startElement('a:ln');
|
$objWriter->startElement('a:ln');
|
||||||
$objWriter->writeAttribute('w', 12700);
|
$objWriter->writeAttribute('w', 12700);
|
||||||
if ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
|
if ($groupType == DataSeries::TYPE_STOCKCHART) {
|
||||||
$objWriter->startElement('a:noFill');
|
$objWriter->startElement('a:noFill');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1162,7 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
|
if (($groupType === DataSeries::TYPE_BARCHART) || ($groupType === DataSeries::TYPE_BARCHART_3D) || ($groupType === DataSeries::TYPE_BUBBLECHART)) {
|
||||||
$objWriter->startElement('c:invertIfNegative');
|
$objWriter->startElement('c:invertIfNegative');
|
||||||
$objWriter->writeAttribute('val', 0);
|
$objWriter->writeAttribute('val', 0);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
@ -1165,7 +1173,7 @@ class Chart extends WriterPart
|
||||||
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
|
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
|
||||||
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
|
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
|
||||||
|
|
||||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) {
|
||||||
if (!is_null($plotGroup->getPlotStyle())) {
|
if (!is_null($plotGroup->getPlotStyle())) {
|
||||||
$plotStyle = $plotGroup->getPlotStyle();
|
$plotStyle = $plotGroup->getPlotStyle();
|
||||||
if ($plotStyle) {
|
if ($plotStyle) {
|
||||||
|
@ -1176,7 +1184,7 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
|
if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) {
|
||||||
$objWriter->startElement('c:xVal');
|
$objWriter->startElement('c:xVal');
|
||||||
} else {
|
} else {
|
||||||
$objWriter->startElement('c:cat');
|
$objWriter->startElement('c:cat');
|
||||||
|
@ -1190,7 +1198,7 @@ class Chart extends WriterPart
|
||||||
if ($plotSeriesValues) {
|
if ($plotSeriesValues) {
|
||||||
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
|
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
|
||||||
|
|
||||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
|
if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) {
|
||||||
$objWriter->startElement('c:yVal');
|
$objWriter->startElement('c:yVal');
|
||||||
} else {
|
} else {
|
||||||
$objWriter->startElement('c:val');
|
$objWriter->startElement('c:val');
|
||||||
|
@ -1200,7 +1208,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
if ($groupType === DataSeries::TYPE_BUBBLECHART) {
|
||||||
$this->writeBubbles($plotSeriesValues, $objWriter, $pSheet);
|
$this->writeBubbles($plotSeriesValues, $objWriter, $pSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1213,7 +1221,7 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Plot Series Label
|
* Write Plot Series Label
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel
|
* @param DataSeriesValues $plotSeriesLabel
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
|
@ -1248,7 +1256,7 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Plot Series Values
|
* Write Plot Series Values
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
|
* @param DataSeriesValues $plotSeriesValues
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
* @param string $groupType Type of plot for dataseries
|
* @param string $groupType Type of plot for dataseries
|
||||||
* @param string $dataType Datatype of series values
|
* @param string $dataType Datatype of series values
|
||||||
|
@ -1307,7 +1315,7 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
$objWriter->startElement('c:' . $dataType . 'Cache');
|
$objWriter->startElement('c:' . $dataType . 'Cache');
|
||||||
|
|
||||||
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
if (($groupType != DataSeries::TYPE_PIECHART) && ($groupType != DataSeries::TYPE_PIECHART_3D) && ($groupType != DataSeries::TYPE_DONUTCHART)) {
|
||||||
if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
|
if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
|
||||||
$objWriter->startElement('c:formatCode');
|
$objWriter->startElement('c:formatCode');
|
||||||
$objWriter->writeRawData($plotSeriesValues->getFormatCode());
|
$objWriter->writeRawData($plotSeriesValues->getFormatCode());
|
||||||
|
@ -1343,7 +1351,7 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Bubble Chart Details
|
* Write Bubble Chart Details
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
|
* @param DataSeriesValues $plotSeriesValues
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
|
@ -1390,12 +1398,12 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* Write Layout
|
* Write Layout
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Chart_Layout $layout
|
* @param Layout $layout
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
*
|
*
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
|
private function writeLayout(Layout $layout = null, $objWriter)
|
||||||
{
|
{
|
||||||
$objWriter->startElement('c:layout');
|
$objWriter->startElement('c:layout');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace PHPExcel\Writer\Excel2007;
|
namespace PHPExcel\Writer\Excel2007;
|
||||||
|
use PHPExcel\Chart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Writer_Excel2007_Drawing
|
* PHPExcel_Writer_Excel2007_Drawing
|
||||||
|
@ -85,11 +86,11 @@ class Drawing extends WriterPart
|
||||||
* Write drawings to XML format
|
* Write drawings to XML format
|
||||||
*
|
*
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
* @param PHPExcel_Chart $pChart
|
* @param Chart $pChart
|
||||||
* @param int $pRelationId
|
* @param int $pRelationId
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
public function writeChart(\PHPExcel\Shared\XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1)
|
public function writeChart(\PHPExcel\Shared\XMLWriter $objWriter = null, Chart $pChart = null, $pRelationId = -1)
|
||||||
{
|
{
|
||||||
$tl = $pChart->getTopLeftPosition();
|
$tl = $pChart->getTopLeftPosition();
|
||||||
$tl['colRow'] = \PHPExcel\Cell::coordinateFromString($tl['cell']);
|
$tl['colRow'] = \PHPExcel\Cell::coordinateFromString($tl['cell']);
|
||||||
|
|
|
@ -306,10 +306,10 @@ class Workbook extends WriterPart
|
||||||
* Write Defined Name for named range
|
* Write Defined Name for named range
|
||||||
*
|
*
|
||||||
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
* @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer
|
||||||
* @param PHPExcel_NamedRange $pNamedRange
|
* @param \PHPExcel\NamedRange $pNamedRange
|
||||||
* @throws \PHPExcel\Writer\Exception
|
* @throws \PHPExcel\Writer\Exception
|
||||||
*/
|
*/
|
||||||
private function writeDefinedNameForNamedRange(\PHPExcel\Shared\XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
|
private function writeDefinedNameForNamedRange(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\NamedRange $pNamedRange)
|
||||||
{
|
{
|
||||||
// definedName for named range
|
// definedName for named range
|
||||||
$objWriter->startElement('definedName');
|
$objWriter->startElement('definedName');
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPExcel\Writer;
|
namespace PHPExcel\Writer;
|
||||||
|
use PHPExcel\Calculation;
|
||||||
|
use PHPExcel\Shared\Font;
|
||||||
|
use PHPExcel\Shared\String;
|
||||||
|
use PHPExcel\Spreadsheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Writer_HTML
|
* PHPExcel_Writer_HTML
|
||||||
|
@ -132,7 +136,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param PHPExcel $phpExcel PHPExcel object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(Spreadsheet $phpExcel)
|
||||||
{
|
{
|
||||||
$this->phpExcel = $phpExcel;
|
$this->phpExcel = $phpExcel;
|
||||||
$this->defaultFont = $this->phpExcel->getDefaultStyle()->getFont();
|
$this->defaultFont = $this->phpExcel->getDefaultStyle()->getFont();
|
||||||
|
@ -149,10 +153,10 @@ class HTML extends BaseWriter implements IWriter
|
||||||
// garbage collect
|
// garbage collect
|
||||||
$this->phpExcel->garbageCollect();
|
$this->phpExcel->garbageCollect();
|
||||||
|
|
||||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
|
$saveDebugLog = Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||||
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||||
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
$saveArrayReturnType = Calculation::getArrayReturnType();
|
||||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE);
|
||||||
|
|
||||||
// Build CSS
|
// Build CSS
|
||||||
$this->buildCSS(!$this->useInlineCss);
|
$this->buildCSS(!$this->useInlineCss);
|
||||||
|
@ -180,8 +184,8 @@ class HTML extends BaseWriter implements IWriter
|
||||||
// Close file
|
// Close file
|
||||||
fclose($fileHandle);
|
fclose($fileHandle);
|
||||||
|
|
||||||
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
|
Calculation::setArrayReturnType($saveArrayReturnType);
|
||||||
PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
|
Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,10 +427,10 @@ class HTML extends BaseWriter implements IWriter
|
||||||
|
|
||||||
// Get worksheet dimension
|
// Get worksheet dimension
|
||||||
$dimension = explode(':', $sheet->calculateWorksheetDimension());
|
$dimension = explode(':', $sheet->calculateWorksheetDimension());
|
||||||
$dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
|
$dimension[0] = \PHPExcel\Cell::coordinateFromString($dimension[0]);
|
||||||
$dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
|
$dimension[0][0] = \PHPExcel\Cell::columnIndexFromString($dimension[0][0]) - 1;
|
||||||
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
|
$dimension[1] = \PHPExcel\Cell::coordinateFromString($dimension[1]);
|
||||||
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
|
$dimension[1][0] = \PHPExcel\Cell::columnIndexFromString($dimension[1][0]) - 1;
|
||||||
|
|
||||||
// row min,max
|
// row min,max
|
||||||
$rowMin = $dimension[0][1];
|
$rowMin = $dimension[0][1];
|
||||||
|
@ -470,7 +474,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
while ($column++ < $dimension[1][0]) {
|
while ($column++ < $dimension[1][0]) {
|
||||||
// Cell exists?
|
// Cell exists?
|
||||||
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
|
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
|
||||||
$rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
|
$rowData[$column] = \PHPExcel\Cell::stringFromColumnIndex($column) . $row;
|
||||||
} else {
|
} else {
|
||||||
$rowData[$column] = '';
|
$rowData[$column] = '';
|
||||||
}
|
}
|
||||||
|
@ -555,11 +559,11 @@ class HTML extends BaseWriter implements IWriter
|
||||||
foreach ($pSheet->getChartCollection() as $chart) {
|
foreach ($pSheet->getChartCollection() as $chart) {
|
||||||
if ($chart instanceof PHPExcel_Chart) {
|
if ($chart instanceof PHPExcel_Chart) {
|
||||||
$chartCoordinates = $chart->getTopLeftPosition();
|
$chartCoordinates = $chart->getTopLeftPosition();
|
||||||
$chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']);
|
$chartTL = \PHPExcel\Cell::coordinateFromString($chartCoordinates['cell']);
|
||||||
$chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
|
$chartCol = \PHPExcel\Cell::columnIndexFromString($chartTL[0]);
|
||||||
if ($chartTL[1] > $rowMax) {
|
if ($chartTL[1] > $rowMax) {
|
||||||
$rowMax = $chartTL[1];
|
$rowMax = $chartTL[1];
|
||||||
if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
|
if ($chartCol > \PHPExcel\Cell::columnIndexFromString($colMax)) {
|
||||||
$colMax = $chartTL[0];
|
$colMax = $chartTL[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -569,11 +573,11 @@ class HTML extends BaseWriter implements IWriter
|
||||||
|
|
||||||
foreach ($pSheet->getDrawingCollection() as $drawing) {
|
foreach ($pSheet->getDrawingCollection() as $drawing) {
|
||||||
if ($drawing instanceof \PHPExcel\Worksheet\Drawing) {
|
if ($drawing instanceof \PHPExcel\Worksheet\Drawing) {
|
||||||
$imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates());
|
$imageTL = \PHPExcel\Cell::coordinateFromString($drawing->getCoordinates());
|
||||||
$imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
|
$imageCol = \PHPExcel\Cell::columnIndexFromString($imageTL[0]);
|
||||||
if ($imageTL[1] > $rowMax) {
|
if ($imageTL[1] > $rowMax) {
|
||||||
$rowMax = $imageTL[1];
|
$rowMax = $imageTL[1];
|
||||||
if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
|
if ($imageCol > \PHPExcel\Cell::columnIndexFromString($colMax)) {
|
||||||
$colMax = $imageTL[0];
|
$colMax = $imageTL[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -856,7 +860,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
$sheet->calculateColumnWidths();
|
$sheet->calculateColumnWidths();
|
||||||
|
|
||||||
// col elements, initialize
|
// col elements, initialize
|
||||||
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
|
$highestColumnIndex = \PHPExcel\Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
|
||||||
$column = -1;
|
$column = -1;
|
||||||
while ($column++ < $highestColumnIndex) {
|
while ($column++ < $highestColumnIndex) {
|
||||||
$this->columnWidths[$sheetIndex][$column] = 42; // approximation
|
$this->columnWidths[$sheetIndex][$column] = 42; // approximation
|
||||||
|
@ -867,7 +871,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
||||||
if (($width = \PHPExcel\Shared\Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) {
|
if (($width = \PHPExcel\Shared\Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) {
|
||||||
$width = \PHPExcel\Shared\Drawing::pixelsToPoints($width);
|
$width = \PHPExcel\Shared\Drawing::pixelsToPoints($width);
|
||||||
$column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
|
$column = \PHPExcel\Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
|
||||||
$this->columnWidths[$sheetIndex][$column] = $width;
|
$this->columnWidths[$sheetIndex][$column] = $width;
|
||||||
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt';
|
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt';
|
||||||
|
|
||||||
|
@ -885,7 +889,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
$css['table.sheet' . $sheetIndex . ' tr'] = array();
|
$css['table.sheet' . $sheetIndex . ' tr'] = array();
|
||||||
|
|
||||||
if ($rowDimension->getRowHeight() == -1) {
|
if ($rowDimension->getRowHeight() == -1) {
|
||||||
$pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
|
$pt_height = Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
|
||||||
} else {
|
} else {
|
||||||
$pt_height = $rowDimension->getRowHeight();
|
$pt_height = $rowDimension->getRowHeight();
|
||||||
}
|
}
|
||||||
|
@ -903,7 +907,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
$css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array();
|
$css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array();
|
||||||
|
|
||||||
if ($rowDimension->getRowHeight() == -1) {
|
if ($rowDimension->getRowHeight() == -1) {
|
||||||
$pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
|
$pt_height = Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
|
||||||
} else {
|
} else {
|
||||||
$pt_height = $rowDimension->getRowHeight();
|
$pt_height = $rowDimension->getRowHeight();
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1106,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write <col> elements
|
// Write <col> elements
|
||||||
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
$highestColumnIndex = \PHPExcel\Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
||||||
$i = -1;
|
$i = -1;
|
||||||
while ($i++ < $highestColumnIndex) {
|
while ($i++ < $highestColumnIndex) {
|
||||||
if (!$this->isPdf) {
|
if (!$this->isPdf) {
|
||||||
|
@ -1180,7 +1184,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
$colNum = 0;
|
$colNum = 0;
|
||||||
foreach ($pValues as $cellAddress) {
|
foreach ($pValues as $cellAddress) {
|
||||||
$cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
|
$cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
|
$coordinate = \PHPExcel\Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
|
||||||
if (!$this->useInlineCss) {
|
if (!$this->useInlineCss) {
|
||||||
$cssClass = '';
|
$cssClass = '';
|
||||||
$cssClass = 'column' . $colNum;
|
$cssClass = 'column' . $colNum;
|
||||||
|
@ -1202,8 +1206,8 @@ class HTML extends BaseWriter implements IWriter
|
||||||
// initialize
|
// initialize
|
||||||
$cellData = ' ';
|
$cellData = ' ';
|
||||||
|
|
||||||
// PHPExcel_Cell
|
// \PHPExcel\Cell
|
||||||
if ($cell instanceof PHPExcel_Cell) {
|
if ($cell instanceof \PHPExcel\Cell) {
|
||||||
$cellData = '';
|
$cellData = '';
|
||||||
if (is_null($cell->getParent())) {
|
if (is_null($cell->getParent())) {
|
||||||
$cell->attach($pSheet);
|
$cell->attach($pSheet);
|
||||||
|
@ -1310,7 +1314,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
|
|
||||||
// Also apply style from last cell in merge to fix borders -
|
// Also apply style from last cell in merge to fix borders -
|
||||||
// relies on !important for non-none border declarations in createCSSStyleBorder
|
// relies on !important for non-none border declarations in createCSSStyleBorder
|
||||||
$endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan);
|
$endCellCoord = \PHPExcel\Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan);
|
||||||
if (!$this->useInlineCss) {
|
if (!$this->useInlineCss) {
|
||||||
$cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex();
|
$cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex();
|
||||||
}
|
}
|
||||||
|
@ -1515,15 +1519,15 @@ class HTML extends BaseWriter implements IWriter
|
||||||
|
|
||||||
// loop through all Excel merged cells
|
// loop through all Excel merged cells
|
||||||
foreach ($sheet->getMergeCells() as $cells) {
|
foreach ($sheet->getMergeCells() as $cells) {
|
||||||
list($cells,) = PHPExcel_Cell::splitRange($cells);
|
list($cells,) = \PHPExcel\Cell::splitRange($cells);
|
||||||
$first = $cells[0];
|
$first = $cells[0];
|
||||||
$last = $cells[1];
|
$last = $cells[1];
|
||||||
|
|
||||||
list($fc, $fr) = PHPExcel_Cell::coordinateFromString($first);
|
list($fc, $fr) = \PHPExcel\Cell::coordinateFromString($first);
|
||||||
$fc = PHPExcel_Cell::columnIndexFromString($fc) - 1;
|
$fc = \PHPExcel\Cell::columnIndexFromString($fc) - 1;
|
||||||
|
|
||||||
list($lc, $lr) = PHPExcel_Cell::coordinateFromString($last);
|
list($lc, $lr) = \PHPExcel\Cell::coordinateFromString($last);
|
||||||
$lc = PHPExcel_Cell::columnIndexFromString($lc) - 1;
|
$lc = \PHPExcel\Cell::columnIndexFromString($lc) - 1;
|
||||||
|
|
||||||
// loop through the individual cells in the individual merge
|
// loop through the individual cells in the individual merge
|
||||||
$r = $fr - 1;
|
$r = $fr - 1;
|
||||||
|
@ -1553,7 +1557,7 @@ class HTML extends BaseWriter implements IWriter
|
||||||
|
|
||||||
// Identify which rows should be omitted in HTML. These are the rows where all the cells
|
// Identify which rows should be omitted in HTML. These are the rows where all the cells
|
||||||
// participate in a merge and the where base cells are somewhere above.
|
// participate in a merge and the where base cells are somewhere above.
|
||||||
$countColumns = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn());
|
$countColumns = \PHPExcel\Cell::columnIndexFromString($sheet->getHighestColumn());
|
||||||
foreach ($candidateSpannedRow as $rowIndex) {
|
foreach ($candidateSpannedRow as $rowIndex) {
|
||||||
if (isset($this->isSpannedCell[$sheetIndex][$rowIndex])) {
|
if (isset($this->isSpannedCell[$sheetIndex][$rowIndex])) {
|
||||||
if (count($this->isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) {
|
if (count($this->isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) {
|
||||||
|
@ -1592,16 +1596,16 @@ class HTML extends BaseWriter implements IWriter
|
||||||
$htmlPage = '@page { ';
|
$htmlPage = '@page { ';
|
||||||
$htmlBody = 'body { ';
|
$htmlBody = 'body { ';
|
||||||
|
|
||||||
$left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
|
$left = String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
|
||||||
$htmlPage .= 'margin-left: ' . $left;
|
$htmlPage .= 'margin-left: ' . $left;
|
||||||
$htmlBody .= 'margin-left: ' . $left;
|
$htmlBody .= 'margin-left: ' . $left;
|
||||||
$right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
|
$right = String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
|
||||||
$htmlPage .= 'margin-right: ' . $right;
|
$htmlPage .= 'margin-right: ' . $right;
|
||||||
$htmlBody .= 'margin-right: ' . $right;
|
$htmlBody .= 'margin-right: ' . $right;
|
||||||
$top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
|
$top = String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
|
||||||
$htmlPage .= 'margin-top: ' . $top;
|
$htmlPage .= 'margin-top: ' . $top;
|
||||||
$htmlBody .= 'margin-top: ' . $top;
|
$htmlBody .= 'margin-top: ' . $top;
|
||||||
$bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
|
$bottom = String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
|
||||||
$htmlPage .= 'margin-bottom: ' . $bottom;
|
$htmlPage .= 'margin-bottom: ' . $bottom;
|
||||||
$htmlBody .= 'margin-bottom: ' . $bottom;
|
$htmlBody .= 'margin-bottom: ' . $bottom;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue