This commit is contained in:
MarkBaker 2016-03-22 14:50:28 +00:00
commit fcaf73e77f
199 changed files with 1810 additions and 2025 deletions

View File

@ -39,7 +39,7 @@ require_once '../Build/PHPExcel.phar';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
$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 ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'OpenDocument');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'OpenDocument');
$objWriter->save('php://output');
exit;

View File

@ -35,14 +35,14 @@ if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** 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
// and its directory location on your server
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
//$rendererName = PHPExcel\Settings::PDF_RENDERER_TCPDF;
$rendererName = PHPExcel\Settings::PDF_RENDERER_MPDF;
//$rendererName = PHPExcel\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
$rendererLibrary = 'mPDF5.4';
//$rendererLibrary = 'domPDF0.6.0beta3';
@ -50,7 +50,7 @@ $rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererL
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
@ -82,7 +82,7 @@ $objPHPExcel->getActiveSheet()->setShowGridLines(false);
$objPHPExcel->setActiveSheetIndex(0);
if (!PHPExcel_Settings::setPdfRenderer(
if (!PHPExcel\Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -99,6 +99,6 @@ header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->save('php://output');
exit;

View File

@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
$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 ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;

View File

@ -35,11 +35,11 @@ if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
$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 ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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);
// 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__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -93,28 +93,28 @@ $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean')
$dateTimeNow = time();
$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
->setCellValue('B9', 'Date')
->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
->setCellValue('C9', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
->setCellValue('B10', 'Time')
->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
->setCellValue('C10', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4);
$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
->setCellValue('B11', 'Date and Time')
->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME);
->setCellValue('C11', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_DATETIME);
$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
->setCellValue('C12', NULL);
$objRichText = new PHPExcel_RichText();
$objRichText = new \PHPExcel\RichText();
$objRichText->createText('你好 ');
$objPayable = $objRichText->createTextRun('你 好 吗?');
$objPayable->getFont()->setBold(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.');
@ -122,11 +122,11 @@ $objPHPExcel->getActiveSheet()->setCellValue('A13', 'Rich Text')
->setCellValue('C13', $objRichText);
$objRichText2 = new PHPExcel_RichText();
$objRichText2 = new \PHPExcel\RichText();
$objRichText2->createText("black text\n");
$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()->getStyle("C14")->getAlignment()->setWrapText(true);
@ -148,7 +148,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel5 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
$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;
$callStartTime = microtime(true);
$objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__));
$objPHPExcel = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$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
@ -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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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
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->setPath('./images/phpexcel_logo.gif');
$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
echo date('H:i:s') , " Set page orientation and size" , EOL;
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename worksheet
echo date('H:i:s') , " Rename worksheet" , EOL;
@ -91,7 +91,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -29,12 +29,12 @@
error_reporting(E_ALL);
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$objPHPExcel->setActiveSheetIndex(0);
$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()->getStyle('D1')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
$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()->setCellValue('E1', '#12566');
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Product Id');
@ -115,13 +115,13 @@ $objPHPExcel->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEE
// Add rich-text string
echo date('H:i:s') , " Add rich-text string" , EOL;
$objRichText = new PHPExcel_RichText();
$objRichText = new \PHPExcel\RichText();
$objRichText->createText('This invoice is ');
$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
$objPayable->getFont()->setBold(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.');
@ -140,7 +140,7 @@ $objPHPExcel->getActiveSheet()->protectCells('A3:E13', 'PHPExcel');
// Set cell number formats
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
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()->setSize(20);
$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
$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()->setUnderline(\PHPExcel\Style\Font::UNDERLINE_SINGLE);
$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('E1')->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('D13')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
// Set alignments
echo date('H:i:s') , " Set alignments" , EOL;
$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('D13')->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('D13')->getAlignment()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_RIGHT);
$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()->setHorizontal(\PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY);
$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(\PHPExcel\Style\Alignment::VERTICAL_CENTER);
$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(
'borders' => array(
'outline' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'style' => \PHPExcel\Style\Border::BORDER_THIN,
'color' => array('argb' => 'FF000000'),
),
),
@ -191,7 +191,7 @@ echo date('H:i:s') , " Set thick brown border outline around Total" , EOL;
$styleThickBrownBorderOutline = array(
'borders' => array(
'outline' => array(
'style' => PHPExcel_Style_Border::BORDER_THICK,
'style' => \PHPExcel\Style\Border::BORDER_THICK,
'color' => array('argb' => 'FF993300'),
),
),
@ -200,7 +200,7 @@ $objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickB
// Set fills
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');
// Set style for header row using alternative method
@ -211,15 +211,15 @@ $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
'bold' => true
),
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT,
),
'borders' => array(
'top' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
'style' => \PHPExcel\Style\Border::BORDER_THIN
)
),
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
'type' => \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90,
'startcolor' => array(
'argb' => 'FFA0A0A0'
@ -234,11 +234,11 @@ $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT,
),
'borders' => 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(
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(
'borders' => 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
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
echo date('H:i:s') , " Add a hyperlink to an external website" , EOL;
$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
$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;
$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
$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
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->setDescription('Logo');
$objDrawing->setPath('./images/officelogo.jpg');
@ -290,7 +290,7 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Add a drawing to the worksheet
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->setDescription('Paid');
$objDrawing->setPath('./images/paid.png');
@ -303,7 +303,7 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Add a drawing to the worksheet
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->setDescription('PHPExcel logo');
$objDrawing->setPath('./images/phpexcel_logo.gif');
@ -326,8 +326,8 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
// Set page orientation and size
echo date('H:i:s') , " Set page orientation and size" , EOL;
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename first worksheet
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()->setSize(20);
$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);
// Add a drawing to the worksheet
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->setDescription('Terms and conditions');
$objDrawing->setPath('./images/termsconditions.jpg');
@ -382,8 +382,8 @@ $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Set page orientation and size
echo date('H:i:s') , " Set page orientation and size" , EOL;
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename second worksheet
echo date('H:i:s') , " Rename second worksheet" , EOL;

View File

@ -36,15 +36,11 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
// Save Excel 2007 file
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite;
if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE;
if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
} else {
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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_TO_SQLITE3;
if (\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
} else {
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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
if (!PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
$cacheMethod = \PHPExcel\CachedObjectStorageFactory::CACHE_IN_MEMORY_GZIP;
if (!\PHPExcel\Settings::setCacheStorageMethod($cacheMethod)) {
die($cacheMethod . " caching method is not available" . 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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** 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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** 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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
if (!file_exists("05featuredemo.xlsx")) {
@ -44,7 +44,7 @@ if (!file_exists("05featuredemo.xlsx")) {
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
$callStartTime = microtime(true);
$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx");
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);

View File

@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
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
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
\PHPExcel\Settings::setZipClass(\PHPExcel\Settings::PCLZIP);
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
$callStartTime = microtime(true);
$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
$objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx");
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -86,30 +86,30 @@ $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
// Add conditional formatting
echo date('H:i:s') , " Add conditional formatting" , EOL;
$objConditional1 = new PHPExcel_Style_Conditional();
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN)
$objConditional1 = new \PHPExcel\Style\Conditional();
$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_BETWEEN)
->addCondition('200')
->addCondition('400');
$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW);
$objConditional1->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_YELLOW);
$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->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
$objConditional2 = new \PHPExcel\Style\Conditional();
$objConditional2->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN)
->addCondition('0');
$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
$objConditional2->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_RED);
$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->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
$objConditional3 = new \PHPExcel\Style\Conditional();
$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
->addCondition('0');
$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
$objConditional3->getStyle()->getFont()->getColor()->setARGB(\PHPExcel\Style\Color::COLOR_GREEN);
$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();
array_push($conditionalStyles, $objConditional1);
@ -142,8 +142,8 @@ $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHP
// Set page orientation and size
echo date('H:i:s') , " Set page orientation and size" , EOL;
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
// Rename worksheet
@ -159,7 +159,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -70,23 +70,23 @@ $objPHPExcel->getActiveSheet()
$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
->getNumberFormat()
->setFormatCode(
PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
\PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00
);
// Add conditional formatting
echo date('H:i:s') , " Add conditional formatting" , EOL;
$objConditional1 = new PHPExcel_Style_Conditional();
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
$objConditional1 = new \PHPExcel\Style\Conditional();
$objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_LESSTHAN)
->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->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
$objConditional3 = new \PHPExcel\Style\Conditional();
$objConditional3->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
->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();
array_push($conditionalStyles, $objConditional1);
@ -106,7 +106,7 @@ $objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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
if ($i % 10 == 0) {
// 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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s').' Create new PHPExcel object'.EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s').' Set document properties'.EOL;
@ -77,7 +77,7 @@ foreach($years as $year) {
foreach($countries as $country) {
$endDays = date('t',mktime(0,0,0,$period,1,$year));
for($i = 1; $i <= $endDays; ++$i) {
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
$year,
$period,
$i
@ -116,8 +116,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$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()->getColumnDimension('F')->setWidth(14);
$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)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'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
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach($periods as $period) {
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
$autoFilter->getColumn('D')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
array(
'year' => $currentYear,
'month' => $period,
'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
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s').' Create new PHPExcel object'.EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s').' Set document properties'.EOL;
@ -59,8 +59,7 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
->setCellValue('C1', 'Country')
->setCellValue('D1', 'Date')
->setCellValue('E1', 'Sales Value')
->setCellValue('F1', 'Expenditure')
;
->setCellValue('F1', 'Expenditure');
$startYear = $endYear = $currentYear = date('Y');
$startYear--;
$endYear++;
@ -77,7 +76,7 @@ foreach($years as $year) {
foreach($countries as $country) {
$endDays = date('t',mktime(0,0,0,$period,1,$year));
for($i = 1; $i <= $endDays; ++$i) {
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
$year,
$period,
$i
@ -116,8 +115,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$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()->getColumnDimension('F')->setWidth(14);
$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
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
$autoFilter->getColumn('C')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'Germany'
);
// Filter the Date column on a filter value of the year to date
$autoFilter->getColumn('D')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
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
$autoFilter->getColumn('E')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
400
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('E')
->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)
->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
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
@ -179,7 +178,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s').' Create new PHPExcel object'.EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s').' Set document properties'.EOL;
@ -77,7 +77,7 @@ foreach($years as $year) {
foreach($countries as $country) {
$endDays = date('t',mktime(0,0,0,$period,1,$year));
for($i = 1; $i <= $endDays; ++$i) {
$eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
$eDate = \PHPExcel\Shared\Date::FormattedPHPToExcel(
$year,
$period,
$i
@ -116,8 +116,8 @@ $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.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('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$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()->getColumnDimension('F')->setWidth(14);
$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)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'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
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach($periods as $period) {
$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
$autoFilter->getColumn('D')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
array(
'year' => $currentYear,
'month' => $period,
'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
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);

View File

@ -35,11 +35,11 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s').' Create new PHPExcel object'.EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -76,7 +76,7 @@ $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
$objPHPExcel->getActiveSheet()
->getStyle('A2:B2')
->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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -37,17 +37,17 @@ date_default_timezone_set('Europe/London');
mt_srand(1234567890);
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// List functions
echo date('H:i:s') , " List implemented functions" , EOL;
$objCalc = PHPExcel_Calculation::getInstance();
$objCalc = \PHPExcel\Calculation::getInstance();
print_r($objCalc->listFunctionNames());
// Create new PHPExcel object
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
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;
$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

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
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
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('B2', '=A2');
PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100;
\PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100;
// Calculated data
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;
$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

View File

@ -36,15 +36,15 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Save Excel 95 file
echo date('H:i:s') , " Write to Excel5 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
@ -76,8 +76,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data
// Set data validation
echo date('H:i:s') , " Set data validation" , EOL;
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP );
$objValidation->setAllowBlank(true);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
@ -89,8 +89,8 @@ $objValidation->setFormula1(10);
$objValidation->setFormula2(20);
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(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 = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
@ -123,7 +123,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel5 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
@ -76,8 +76,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data
// Set data validation
echo date('H:i:s') , " Set data validation" , EOL;
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_STOP );
$objValidation->setAllowBlank(true);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
@ -89,8 +89,8 @@ $objValidation->setFormula1(10);
$objValidation->setFormula2(20);
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(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->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setType( \PHPExcel\Cell\DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( \PHPExcel\Cell\DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
@ -124,7 +124,7 @@ $objPHPExcel->setActiveSheetIndex(0);
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
echo date('H:i:s') , " Write to CSV format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0)
->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;
$callStartTime = microtime(true);
$objReader = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')
$objReader = \PHPExcel\IOFactory::createReader('CSV')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
$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;
$callStartTime = microtime(true);
$objWriter2007 = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
$objWriter2007 = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
$objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriterCSV = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
$objWriterCSV = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
$objWriterCSV->setExcelCompatibility(true);
$objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__));
$callEndTime = microtime(true);

View File

@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
echo date('H:i:s') , " Write to HTML format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->setSheetIndex(0);
//$objWriter->setImagesRoot('http://www.example.com');
$objWriter->save(str_replace('.php', '.htm', __FILE__));

View File

@ -36,17 +36,17 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// List functions
echo date('H:i:s') . " List implemented functions\n";
$objCalc = PHPExcel_Calculation::getInstance();
$objCalc = \PHPExcel\Calculation::getInstance();
print_r($objCalc->listFunctionNames());
// Create new PHPExcel object
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
echo date('H:i:s') . " Add some data\n";

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -66,8 +66,8 @@ $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:')
// Define named ranges
echo date('H:i:s') , " Define named ranges" , EOL;
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') );
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') );
$objPHPExcel->addNamedRange( new \PHPExcel\NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
// Rename named ranges
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -35,8 +35,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
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;
$callStartTime = microtime(true);
$objPHPExcel = PHPExcel_IOFactory::load("14excel5.xls");
$objPHPExcel = \PHPExcel\IOFactory::load("14excel5.xls");
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -37,15 +37,15 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF;
$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
//$rendererLibrary = 'mPDF5.4';
$rendererLibrary = 'domPDF0.6.0beta3';
@ -56,12 +56,12 @@ echo date('H:i:s') , " Hide grid lines" , EOL;
$objPHPExcel->getActiveSheet()->setShowGridLines(false);
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;
if (!PHPExcel_Settings::setPdfRenderer(
if (!\PHPExcel\Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -75,7 +75,7 @@ if (!PHPExcel_Settings::setPdfRenderer(
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->setSheetIndex(0);
$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__));
$callEndTime = microtime(true);

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -60,19 +60,19 @@ $objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
array('fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
)
)
);
$objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
array('fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
'color' => array('argb' => 'FFFFFF00')
),
)
@ -82,7 +82,7 @@ $objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$objPHPExcel->setActiveSheetIndex(0);
$sharedStyle1 = new PHPExcel_Style();
$sharedStyle2 = new PHPExcel_Style();
$sharedStyle1 = new \PHPExcel\Style();
$sharedStyle2 = new \PHPExcel\Style();
$sharedStyle1->applyFromArray(
array('fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
)
));
$sharedStyle2->applyFromArray(
array('fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'type' => \PHPExcel\Style\Fill::FILL_SOLID,
'color' => array('argb' => 'FFFFFF00')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN),
'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM)
)
));
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A1:T100");
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, "C5:R95");
$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle1, "A1:T100");
$objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95");
// Save Excel 2007 file
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Check prerequisites
@ -42,7 +42,7 @@ if (!file_exists("06largescale.xlsx")) {
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 = '') {
// 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;
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader = \PHPExcel\IOFactory::createReader('Excel2007');
$objReader->setReadFilter( new MyReadFilter() );
$objPHPExcel = $objReader->load("06largescale.xlsx");
@ -64,7 +64,7 @@ echo date('H:i:s') , " Remove unnecessary rows" , EOL;
$objPHPExcel->getActiveSheet()->removeRow(2, 18);
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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
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->setDescription('Sample image');
$objDrawing->setImageResource($gdImage);
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setRenderingFunction(\PHPExcel\Worksheet\MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(\PHPExcel\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setHeight(36);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
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__));
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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save(str_replace('.php', '.html', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -35,14 +35,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** 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
// and its directory location on your server
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_TCPDF;
//$rendererName = \PHPExcel\Settings::PDF_RENDERER_MPDF;
$rendererName = \PHPExcel\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
//$rendererLibrary = 'mPDF5.4';
$rendererLibrary = 'domPDF0.6.0beta3';
@ -51,33 +51,33 @@ $rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
// Read from Excel2007 (.xlsx) template
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");
/** at this point, we could do some manipulations with the template, but we skip this step */
// Export to Excel2007 (.xlsx)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Export to Excel5 (.xls)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Export to HTML (.html)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Export to PDF (.pdf)
echo date('H:i:s') , " Write to PDF format" , EOL;
try {
if (!PHPExcel_Settings::setPdfRenderer(
if (!\PHPExcel\Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -88,7 +88,7 @@ try {
EOL
);
} else {
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->save(str_replace('.php', '.pdf', __FILE__));
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)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -35,23 +35,23 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Read from Excel5 (.xls) template
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");
// Export to Excel2007 (.xlsx)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Export to Excel5 (.xls)
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -34,16 +34,15 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
if (!file_exists("05featuredemo.xlsx")) {
exit("Please run 05featuredemo.php first." . 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");
echo date('H:i:s') , " Iterate worksheets" , EOL;

View File

@ -33,7 +33,7 @@ ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Set timezone
@ -42,11 +42,11 @@ date_default_timezone_set('UTC');
// Set value binder
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
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -165,12 +165,12 @@ $objPHPExcel->setActiveSheetIndex(0);
// Save Excel 2007 file
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Save Excel5 file
echo date('H:i:s') , " Write to Excel5 format" , EOL;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -34,13 +34,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
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");
@ -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;
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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$inputFileType = 'Excel5';
@ -45,7 +45,7 @@ $inputFileName = 'templates/31docproperties.xls';
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
$callStartTime = microtime(true);
$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType);
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
$callEndTime = microtime(true);
@ -64,7 +64,7 @@ $objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document")
// Save Excel 95 file
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__));
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;
// Reread File
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
echo date('H:i:s') , " Get properties" , EOL;
@ -106,9 +106,9 @@ foreach($customProperties as $customProperty) {
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
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;
} elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
} elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
} else {
echo $propertyValue , EOL;

View File

@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$inputFileType = 'Excel2007';
@ -45,7 +45,7 @@ $inputFileName = 'templates/31docproperties.xlsx';
echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
$callStartTime = microtime(true);
$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType);
$objPHPExcel = $objPHPExcelReader->load($inputFileName);
$callEndTime = microtime(true);
@ -64,7 +64,7 @@ $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document")
// Save Excel 2007 file
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__));
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;
// Reread File
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
echo date('H:i:s') , " Get properties" , EOL;
@ -106,9 +106,9 @@ foreach($customProperties as $customProperty) {
$propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
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;
} elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
} elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
} else {
echo $propertyValue , EOL;

View File

@ -10,37 +10,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/**
* PHPExcel
*
* 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';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
$inputFileType = 'Excel2007';
$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;
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load($inputFileName);
@ -114,7 +85,7 @@ foreach($inputFileNames as $inputFileName) {
$outputFileName = basename($inputFileName);
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->save($outputFileName);
echo date('H:i:s') , " File written to " , $outputFileName , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -82,15 +82,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -98,16 +98,16 @@ $series = new PHPExcel_Chart_DataSeries(
);
// 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
$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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -128,7 +128,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -82,15 +82,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
// 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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -82,15 +82,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
// 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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Bar Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -68,9 +68,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$E$1', NULL, 1), // 'Actual'
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!$E$1', NULL, 1), // 'Actual'
);
// Set the X-Axis Labels
// Datatype
@ -80,7 +80,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -90,15 +90,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$E$2:$E$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!$E$2:$E$13', NULL, 12),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -106,20 +106,20 @@ $series = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
// 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');
$xAxisLabel = new PHPExcel_Chart_Title('Financial Period');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Grouped Column Chart');
$xAxisLabel = new \PHPExcel\Chart\Title('Financial Period');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -140,7 +140,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -82,15 +82,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -98,19 +98,19 @@ $series = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
// 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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Column Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -131,7 +131,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -69,13 +69,13 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$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(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall
);
$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
@ -86,7 +86,7 @@ $dataSeriesLabels3 = array(
// Data values
// Data Marker
$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 Marker
$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
$series1 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
$series1 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues1)-1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues, // plotCategory
@ -112,7 +112,7 @@ $series1 = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
@ -123,13 +123,13 @@ $series1->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
// Data values
// Data Marker
$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
$series2 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
$series2 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2)-1), // plotOrder
$dataSeriesLabels2, // plotLabel
NULL, // plotCategory
@ -145,13 +145,13 @@ $series2 = new PHPExcel_Chart_DataSeries(
// Data values
// Data Marker
$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
$series3 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
$series3 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2)-1), // plotOrder
$dataSeriesLabels3, // plotLabel
NULL, // plotCategory
@ -160,15 +160,15 @@ $series3 = new PHPExcel_Chart_DataSeries(
// 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
$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
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -189,7 +189,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,9 +60,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -72,7 +72,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -82,15 +82,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_LINECHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@ -98,16 +98,16 @@ $series = new PHPExcel_Chart_DataSeries(
);
// 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
$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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Stacked Line Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -128,7 +128,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -61,9 +61,9 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -73,7 +73,7 @@ $dataSeriesLabels1 = array(
// Data values
// Data Marker
$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
// Datatype
@ -83,15 +83,15 @@ $xAxisTickValues1 = array(
// Data values
// Data Marker
$dataSeriesValues1 = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series1 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
$series1 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_AREACHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues1)-1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues1, // plotCategory
@ -99,16 +99,16 @@ $series1 = new PHPExcel_Chart_DataSeries(
);
// 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
$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');
$yAxisLabel1 = new PHPExcel_Chart_Title('Value ($k)');
$title1 = new \PHPExcel\Chart\Title('Test %age-Stacked Area Chart');
$yAxisLabel1 = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart1 = new PHPExcel_Chart(
$chart1 = new \PHPExcel\Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@ -135,9 +135,9 @@ $objWorksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -147,7 +147,7 @@ $dataSeriesLabels2 = array(
// Data values
// Data Marker
$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
// Datatype
@ -157,15 +157,15 @@ $xAxisTickValues2 = array(
// Data values
// Data Marker
$dataSeriesValues2 = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series2 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
$series2 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
\PHPExcel\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2)-1), // plotOrder
$dataSeriesLabels2, // plotLabel
$xAxisTickValues2, // plotCategory
@ -173,19 +173,19 @@ $series2 = new PHPExcel_Chart_DataSeries(
);
// Set additional dataseries parameters
// 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
$plotArea2 = new PHPExcel_Chart_PlotArea(NULL, array($series2));
$plotArea2 = new \PHPExcel\Chart\PlotArea(NULL, array($series2));
// 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');
$yAxisLabel2 = new PHPExcel_Chart_Title('Value ($k)');
$title2 = new \PHPExcel\Chart\Title('Test Column Chart');
$yAxisLabel2 = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart2 = new PHPExcel_Chart(
$chart2 = new \PHPExcel\Chart(
'chart2', // name
$title2, // title
$legend2, // legend
@ -206,7 +206,7 @@ $objWorksheet->addChart($chart2);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -61,7 +61,7 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$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
// Datatype
@ -71,7 +71,7 @@ $dataSeriesLabels1 = array(
// Data values
// Data Marker
$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
// Datatype
@ -81,12 +81,12 @@ $xAxisTickValues1 = array(
// Data values
// Data Marker
$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
$series1 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_PIECHART, // plotType
$series1 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_PIECHART, // plotType
NULL, // plotGrouping (Pie charts don't have any grouping)
range(0, count($dataSeriesValues1)-1), // plotOrder
$dataSeriesLabels1, // plotLabel
@ -95,20 +95,20 @@ $series1 = new PHPExcel_Chart_DataSeries(
);
// Set up a layout object for the Pie chart
$layout1 = new PHPExcel_Chart_Layout();
$layout1 = new \PHPExcel\Chart\Layout();
$layout1->setShowVal(TRUE);
$layout1->setShowPercent(TRUE);
// 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
$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
$chart1 = new PHPExcel_Chart(
$chart1 = new \PHPExcel\Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@ -135,7 +135,7 @@ $objWorksheet->addChart($chart1);
// Data values
// Data Marker
$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
// Datatype
@ -145,7 +145,7 @@ $dataSeriesLabels2 = array(
// Data values
// Data Marker
$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
// Datatype
@ -155,12 +155,12 @@ $xAxisTickValues2 = array(
// Data values
// Data Marker
$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
$series2 = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_DONUTCHART, // plotType
$series2 = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_DONUTCHART, // plotType
NULL, // plotGrouping (Donut charts don't have any grouping)
range(0, count($dataSeriesValues2)-1), // plotOrder
$dataSeriesLabels2, // plotLabel
@ -169,18 +169,18 @@ $series2 = new PHPExcel_Chart_DataSeries(
);
// Set up a layout object for the Pie chart
$layout2 = new PHPExcel_Chart_Layout();
$layout2 = new \PHPExcel\Chart\Layout();
$layout2->setShowVal(TRUE);
$layout2->setShowCatName(TRUE);
// 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
$chart2 = new PHPExcel_Chart(
$chart2 = new \PHPExcel\Chart(
'chart2', // name
$title2, // title
NULL, // legend
@ -201,7 +201,7 @@ $objWorksheet->addChart($chart2);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -69,8 +69,8 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$C$1', NULL, 1), // 2011
new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
// Datatype
@ -80,8 +80,8 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -91,35 +91,35 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$C$2:$C$13', NULL, 12),
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_RADARCHART, // plotType
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_RADARCHART, // plotType
NULL, // plotGrouping (Radar charts don't have any grouping)
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues, // plotValues
NULL, // smooth line
PHPExcel_Chart_DataSeries::STYLE_MARKER // plotStyle
\PHPExcel\Chart\DataSeries::STYLE_MARKER // plotStyle
);
// 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
$plotArea = new PHPExcel_Chart_PlotArea($layout, array($series));
$plotArea = new \PHPExcel\Chart\PlotArea($layout, array($series));
// 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
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -140,7 +140,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -60,13 +60,13 @@ $objWorksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$D$1', NULL, 1), // 2012
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!$D$1', NULL, 1), // 2012
);
// Set the X-Axis Labels
$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
// Datatype
@ -76,34 +76,34 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$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!$D$2:$D$5', NULL, 4),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART, // plotType
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
NULL, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues, // plotValues
NULL, // smooth line
PHPExcel_Chart_DataSeries::STYLE_LINEMARKER // plotStyle
\PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
);
// 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
$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');
$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
$title = new \PHPExcel\Chart\Title('Test Scatter Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'chart1', // name
$title, // title
$legend, // legend
@ -124,7 +124,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -37,10 +37,10 @@ date_default_timezone_set('Europe/London');
*/
/** 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->fromArray(
array(
@ -52,7 +52,7 @@ $objWorksheet->fromArray(
array(100, 40, 5, 0, 50 ),
), 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
@ -63,10 +63,10 @@ $objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel_Styl
// Data values
// Data Marker
$dataSeriesLabels = array(
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!$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!$B$1', NULL, 1), //Max / Open
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!$E$1', NULL, 1), //Max Threshold / Max
);
// Set the X-Axis Labels
// Datatype
@ -76,7 +76,7 @@ $dataSeriesLabels = array(
// Data values
// Data Marker
$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
// Datatype
@ -86,15 +86,15 @@ $xAxisTickValues = array(
// Data values
// Data Marker
$dataSeriesValues = array(
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!$D$2:$D$6', NULL, 5),
new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E$2:$E$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!$D$2:$D$6', NULL, 5),
new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', NULL, 5),
);
// Build the dataseries
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_STOCKCHART, // plotType
$series = new \PHPExcel\Chart\DataSeries(
\PHPExcel\Chart\DataSeries::TYPE_STOCKCHART, // plotType
null, // plotGrouping - if we set this to not null, then xlsx throws error
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
@ -103,16 +103,16 @@ $series = new PHPExcel_Chart_DataSeries(
);
// 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
$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');
$xAxisLabel = new PHPExcel_Chart_Title('Counts');
$yAxisLabel = new PHPExcel_Chart_Title('Values');
$title = new \PHPExcel\Chart\Title('Test Stock Chart');
$xAxisLabel = new \PHPExcel\Chart\Title('Counts');
$yAxisLabel = new \PHPExcel\Chart\Title('Values');
// Create the chart
$chart = new PHPExcel_Chart(
$chart = new \PHPExcel\Chart(
'stock-chart', // name
$title, // title
$legend, // legend
@ -133,7 +133,7 @@ $objWorksheet->addChart($chart);
// Save Excel 2007 file
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);
$filename = str_replace('.php', '.xlsx', __FILE__);
if(file_exists($filename)) {

View File

@ -37,14 +37,14 @@ date_default_timezone_set('Europe/London');
*/
/** PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
if (!file_exists("33chartcreate-bar.xlsx")) {
exit("Please run 33chartcreate-bar.php first." . EOL);
}
echo date('H:i:s') , " Load from Excel2007 file" , EOL;
$objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objReader = \PHPExcel\IOFactory::createReader("Excel2007");
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx");
@ -64,7 +64,7 @@ $objWorksheet->fromArray(
// Save Excel 2007 file
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->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/**
* PHPExcel
*
* 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';
/** PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH;
$rendererLibrary = 'jpgraph3.5.0b1/src/';
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
if (!PHPExcel_Settings::setChartRenderer(
if (!PHPExcel\Settings::setChartRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -83,7 +54,7 @@ foreach($inputFileNames as $inputFileName) {
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);
$objPHPExcel = $objReader->load($inputFileName);

View File

@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/**
* PHPExcel
*
* 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';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
$rendererName = PHPExcel\Settings::CHART_RENDERER_JPGRAPH;
$rendererLibrary = 'jpgraph3.5.0b1/src/';
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
if (!PHPExcel_Settings::setChartRenderer(
if (!PHPExcel\Settings::setChartRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -83,7 +54,7 @@ foreach($inputFileNames as $inputFileName) {
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);
$objPHPExcel = $objReader->load($inputFileName);
@ -134,7 +105,7 @@ foreach($inputFileNames as $inputFileName) {
$outputFileName = str_replace('.xlsx', '.html', basename($inputFileName));
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->save($outputFileName);
echo date('H:i:s') , " File written to " , $outputFileName , EOL;

View File

@ -10,51 +10,22 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/**
* PHPExcel
*
* 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';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Change these values to select the Rendering library that you wish to use
// for PDF files, and its directory location on your server
//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
//$rendererName = PHPExcel\Settings::PDF_RENDERER_TCPDF;
$rendererName = PHPExcel\Settings::PDF_RENDERER_MPDF;
//$rendererName = PHPExcel\Settings::PDF_RENDERER_DOMPDF;
//$rendererLibrary = 'tcPDF5.9';
$rendererLibrary = 'mPDF5.4';
//$rendererLibrary = 'domPDF0.6.0beta3';
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
if (!PHPExcel_Settings::setPdfRenderer(
if (!PHPExcel\Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -68,12 +39,12 @@ if (!PHPExcel_Settings::setPdfRenderer(
// Change these values to select the Rendering library that you wish to use
// 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/';
$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
if (!PHPExcel_Settings::setChartRenderer(
if (!PHPExcel\Settings::setChartRenderer(
$rendererName,
$rendererLibraryPath
)) {
@ -106,7 +77,7 @@ foreach($inputFileNames as $inputFileName) {
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);
$objPHPExcel = $objReader->load($inputFileName);
@ -157,7 +128,7 @@ foreach($inputFileNames as $inputFileName) {
$outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName));
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->save($outputFileName);
echo date('H:i:s') , " File written to " , $outputFileName , EOL;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -62,16 +62,16 @@ $objPHPExcel->setActiveSheetIndex(0)
$objPHPExcel->setActiveSheetIndex(0);
// 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
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
// Save Excel5 file
echo date('H:i:s') , " Write to Excel5 format" , EOL;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London');
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
// Set document properties
echo date('H:i:s') , " Set document properties" , EOL;
@ -74,7 +74,7 @@ foreach(glob('./data/continents/*') as $key => $filename) {
$objPHPExcel->getActiveSheet()
->fromArray($countries, null, $column . '1');
$objPHPExcel->addNamedRange(
new PHPExcel_NamedRange(
new PHPExcel\NamedRange(
$continent,
$objPHPExcel->getActiveSheet(), $column . '1:' . $column . $countryCount
)
@ -95,7 +95,7 @@ $objPHPExcel->getActiveSheet()
->setVisible(false);
$objPHPExcel->addNamedRange(
new PHPExcel_NamedRange(
new PHPExcel\NamedRange(
'Continents',
$objPHPExcel->getActiveSheet(), $continentColumn . '1:' . $continentColumn . ($key+1)
)
@ -119,8 +119,8 @@ $objPHPExcel->getActiveSheet()
$objValidation = $objPHPExcel->getActiveSheet()
->getCell('B1')
->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST )
->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION )
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
@ -140,8 +140,8 @@ $objPHPExcel->getActiveSheet()
$objValidation = $objPHPExcel->getActiveSheet()
->getCell('B3')
->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
$objValidation->setType( PHPExcel\Cell\DataValidation::TYPE_LIST )
->setErrorStyle( PHPExcel\Cell\DataValidation::STYLE_INFORMATION )
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
@ -163,7 +163,7 @@ $objPHPExcel->setActiveSheetIndex(0);
// Save Excel 2007 file
// This linked validation list method only seems to work for Excel2007, not for Excel5
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -10,16 +10,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** 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;
$objPHPExcel = new PHPExcel();
$objPHPExcel = new \PHPExcel\Spreadsheet();
$worksheet = $objPHPExcel->getActiveSheet();
echo date('H:i:s') , " Create styles array" , EOL;
$styles = array();
for ($i = 0; $i < 10; $i++) {
$style = new PHPExcel_Style();
$style = new \PHPExcel\Style();
$style->getFont()->setSize($i + 4);
$styles[] = $style;
}
@ -30,7 +30,7 @@ for ($col = 0; $col < 50; $col++) {
for ($row = 0; $row < 100; $row++) {
$str = ($row + $col);
$style = $styles[$row % 10];
$coord = PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1);
$coord = \PHPExcel\Cell::stringFromColumnIndex($col) . ($row + 1);
$worksheet->setCellValue($coord, $str);
$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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;

View File

@ -36,8 +36,8 @@ date_default_timezone_set('Europe/London');
include "05featuredemo.inc.php";
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
// Set password against the spreadsheet file
@ -50,7 +50,7 @@ $objPHPExcel->getSecurity()->setWorkbookPassword('secret');
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;

View File

@ -33,14 +33,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL;
$callStartTime = microtime(true);
$objPHPExcel1 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx");
$objPHPExcel1 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx");
$callEndTime = microtime(true);
$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;
$callStartTime = microtime(true);
$objPHPExcel2 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx");
$objPHPExcel2 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx");
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;
@ -71,7 +71,7 @@ foreach($objPHPExcel2->getSheetNames() as $sheetName) {
echo date('H:i:s') , " Write to Excel2007 format" , EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel1, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel1, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);

View File

@ -33,17 +33,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../src/Bootstrap.php';
if (!file_exists("05featuredemo.xlsx")) {
exit("Please run 05featuredemo.php first." . EOL);
}
$inputFileName = "05featuredemo.xlsx";
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$inputFileType = \PHPExcel\IOFactory::identify($inputFileName);
$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
$sheetList = $objReader->listWorksheetNames($inputFileName);
$sheetInfo = $objReader->listWorksheetInfo($inputFileName);

View File

@ -30,14 +30,14 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
echo date('H:i:s') , " Load from Excel2003XML file" , PHP_EOL;
$callStartTime = microtime(true);
$objReader = PHPExcel_IOFactory::createReader('Excel2003XML');
$objReader = \PHPExcel\IOFactory::createReader('Excel2003XML');
$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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL;

View File

@ -30,13 +30,13 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
echo date('H:i:s') , " Load from Gnumeric file" , PHP_EOL;
$callStartTime = microtime(true);
$objReader = PHPExcel_IOFactory::createReader('Gnumeric');
$objReader = \PHPExcel\IOFactory::createReader('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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;

View File

@ -30,13 +30,13 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
$callStartTime = microtime(true);
$objReader = PHPExcel_IOFactory::createReader('OOCalc');
$objReader = \PHPExcel\IOFactory::createReader('OOCalc');
$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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;

View File

@ -30,16 +30,16 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
// 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;
$callStartTime = microtime(true);
$objReader = PHPExcel_IOFactory::createReader('OOCalc');
$objReader = \PHPExcel\IOFactory::createReader('OOCalc');
$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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;

View File

@ -40,7 +40,7 @@ if (isset($_POST['submit'])) {
include 'PHPExcel/IOFactory.php';
/** 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 **/
$objPHPExcel->getActiveSheet()->setCellValue('A1', $_POST['A']);

View File

@ -30,15 +30,15 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
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;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;

View File

@ -30,7 +30,7 @@ error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
/** \PHPExcel\IOFactory */
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";
/** Identify the type of $inputFileName **/
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$inputFileType = \PHPExcel\IOFactory::identify($inputFileName);
echo 'Loading ' , $inputFileName , ' using ' , $inputFileType , " Reader" , PHP_EOL;
/** 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 **/
$objPHPExcel = $objReader->load($inputFileName);
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__));
echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;

View File

@ -308,7 +308,7 @@ class SQLite3 extends CacheBase implements ICache
$this->TableName = str_replace('.', '_', $this->getUniqueID());
$_DBName = ':memory:';
$this->DBHandle = new SQLite3($_DBName);
$this->DBHandle = new \SQLite3($_DBName);
if ($this->DBHandle === false) {
throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg());
}

View File

@ -2093,7 +2093,7 @@ class Calculation
public static function getInstance(Spreadsheet $spreadsheet = null)
{
if ($spreadsheet !== null) {
$instance = $workbook->getCalculationEngine();
$instance = $spreadsheet->getCalculationEngine();
if (isset($instance)) {
return $instance;
}

View File

@ -1489,7 +1489,7 @@ class DateTime
case Functions::RETURNDATE_EXCEL:
return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject);
case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) \PHPExcel\Shared\Date::ExcelToPHP(PHPExcel\Shared\Date::PHPToExcel($PHPDateObject));
return (integer) \PHPExcel\Shared\Date::ExcelToPHP(\PHPExcel\Shared\Date::PHPToExcel($PHPDateObject));
case Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject;
}

View File

@ -1226,7 +1226,8 @@ class MathTrig
* @param string $condition The criteria that defines which cells will be summed.
* @return float
*/
public static function SUMIFS() {
public static function SUMIFS()
{
$arrayList = func_get_args();
// Return value

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Chart;
/**
* PHPExcel_Chart_DataSeriesValues
* \PHPExcel\Chart\DataSeriesValues
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Chart;
/**
* PHPExcel_Chart_Layout
* \PHPExcel\Chart\Layout
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Chart;
/**
* PHPExcel_Chart_Legend
* \PHPExcel\Chart\Legend
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -198,7 +198,7 @@ class IOFactory
{
$reader = self::createReaderForFile($pFilename);
$className = get_class($reader);
$classType = explode('_', $className);
$classType = explode('\\', $className);
unset($reader);
return array_pop($classType);
}

View File

@ -3,7 +3,7 @@
namespace PHPExcel;
/**
* PHPExcel_NamedRange
* PHPExcel\NamedRange
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -2,6 +2,8 @@
namespace PHPExcel\Reader;
use PHPExcel\Spreadsheet;
/**
* PHPExcel_Reader_CSV
*
@ -231,11 +233,11 @@ class CSV extends BaseReader implements IReader
* Loads PHPExcel from file into PHPExcel instance
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @param Spreadsheet $objPHPExcel
* @return Spreadsheet
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
public function loadIntoExisting($pFilename, Spreadsheet $objPHPExcel)
{
$lineEnding = ini_get('auto_detect_line_endings');
ini_set('auto_detect_line_endings', true);

View File

@ -1,6 +1,7 @@
<?php
namespace PHPExcel\Reader;
use PHPExcel\Shared\TimeZone;
/**
* PHPExcel_Reader_Excel2003XML
@ -310,8 +311,8 @@ class Excel2003XML extends BaseReader implements IReader
\PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY
);
$timezoneObj = new DateTimeZone('Europe/London');
$GMT = new DateTimeZone('UTC');
$timezoneObj = new \DateTimeZone('Europe/London');
$GMT = new \DateTimeZone('UTC');
// Check if file exists
if (!file_exists($pFilename)) {

View File

@ -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")];
$xml = new XMLReader();
$xml = new \XMLReader();
$res = $xml->xml(
$this->securityScanFile(
'zip://'.\PHPExcel\Shared\File::realpath($pFilename).'#'."$dir/$fileWorksheet"
@ -237,12 +237,12 @@ class Excel2007 extends BaseReader implements IReader
$currCells = 0;
while ($xml->read()) {
if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) {
if ($xml->name == 'row' && $xml->nodeType == \XMLReader::ELEMENT) {
$row = $xml->getAttribute('r');
$tmpInfo['totalRows'] = $row;
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
$currCells = 0;
} elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) {
} elseif ($xml->name == 'c' && $xml->nodeType == \XMLReader::ELEMENT) {
$currCells++;
}
}
@ -344,11 +344,11 @@ class Excel2007 extends BaseReader implements IReader
// Apache POI fixes
$contents = $archive->getFromIndex(
$archive->locateName($fileName, ZIPARCHIVE::FL_NOCASE)
$archive->locateName($fileName, \ZipArchive::FL_NOCASE)
);
if ($contents === false) {
$contents = $archive->getFromIndex(
$archive->locateName(substr($fileName, 1), ZIPARCHIVE::FL_NOCASE)
$archive->locateName(substr($fileName, 1), \ZipArchive::FL_NOCASE)
);
}
@ -1561,7 +1561,7 @@ class Excel2007 extends BaseReader implements IReader
$this->getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")
),
'SimpleXMLElement',
\PHPExcel|Settings::getLibXmlLoaderOptions()
\PHPExcel\Settings::getLibXmlLoaderOptions()
);
$images = array();
@ -1655,9 +1655,9 @@ class Excel2007 extends BaseReader implements IReader
$objDrawing->setResizeProportional(false);
if ($xfrm) {
$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->setRotation(\PHPExcel\Shared_Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
$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->setRotation(\PHPExcel\Shared\Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
@ -1671,12 +1671,12 @@ class Excel2007 extends BaseReader implements IReader
}
$objDrawing->setWorksheet($docSheet);
} elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) {
$fromCoordinate = PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
$fromOffsetX = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->colOff);
$fromOffsetY = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
$toCoordinate = PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
$toOffsetX = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->colOff);
$toOffsetY = PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
$fromCoordinate = \PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
$fromOffsetX = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->colOff);
$fromOffsetY = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
$toCoordinate = \PHPExcel\Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
$toOffsetX = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->colOff);
$toOffsetY = \PHPExcel\Shared\Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
$graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
@ -1876,7 +1876,7 @@ class Excel2007 extends BaseReader implements IReader
'SimpleXMLElement',
\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 />';
// var_dump($charts[$chartEntryRef]);

View File

@ -615,7 +615,7 @@ class Excel5 extends BaseReader implements IReader
$this->loadOLE($pFilename);
// Initialisations
$this->phpExcel = new PHPExcel;
$this->phpExcel = new \PHPExcel\Spreadsheet();
$this->phpExcel->removeSheetByIndex(0); // remove 1st sheet
if (!$this->readDataOnly) {
$this->phpExcel->removeCellStyleXfByIndex(0); // remove the default style

View File

@ -300,7 +300,7 @@ class Escher
$blipData = substr($recordData, 36 + $cbName);
// record is a container, read contents
$reader = new \PHPExcel\Reader\Excel5_Escher($BSE);
$reader = new \PHPExcel\Reader\Excel5\Escher($BSE);
$reader->load($blipData);
}
@ -446,7 +446,7 @@ class Escher
$this->pos += 8 + $length;
// record is a container, read contents
$dgContainer = new \PHPExcel\Shared_Escher\DgContainer();
$dgContainer = new \PHPExcel\Shared\Escher\DgContainer();
$this->object->setDgContainer($dgContainer);
$reader = new \PHPExcel\Reader\Excel5\Escher($dgContainer);
$escher = $reader->load($recordData);

View File

@ -2,25 +2,25 @@
namespace PHPExcel\Reader\Excel5\Style;
use \PHPExcel\Style\Border;
use \PHPExcel\Style\Border as StyleBorder;
class Border
{
protected static $map = array(
0x00 => Border::BORDER_NONE,
0x01 => Border::BORDER_THIN,
0x02 => Border::BORDER_MEDIUM,
0x03 => Border::BORDER_DASHED,
0x04 => Border::BORDER_DOTTED,
0x05 => Border::BORDER_THICK,
0x06 => Border::BORDER_DOUBLE,
0x07 => Border::BORDER_HAIR,
0x08 => Border::BORDER_MEDIUMDASHED,
0x09 => Border::BORDER_DASHDOT,
0x0A => Border::BORDER_MEDIUMDASHDOT,
0x0B => Border::BORDER_DASHDOTDOT,
0x0C => Border::BORDER_MEDIUMDASHDOTDOT,
0x0D => Border::BORDER_SLANTDASHDOT,
0x00 => StyleBorder::BORDER_NONE,
0x01 => StyleBorder::BORDER_THIN,
0x02 => StyleBorder::BORDER_MEDIUM,
0x03 => StyleBorder::BORDER_DASHED,
0x04 => StyleBorder::BORDER_DOTTED,
0x05 => StyleBorder::BORDER_THICK,
0x06 => StyleBorder::BORDER_DOUBLE,
0x07 => StyleBorder::BORDER_HAIR,
0x08 => StyleBorder::BORDER_MEDIUMDASHED,
0x09 => StyleBorder::BORDER_DASHDOT,
0x0A => StyleBorder::BORDER_MEDIUMDASHDOT,
0x0B => StyleBorder::BORDER_DASHDOTDOT,
0x0C => StyleBorder::BORDER_MEDIUMDASHDOTDOT,
0x0D => StyleBorder::BORDER_SLANTDASHDOT,
);
/**
@ -35,6 +35,6 @@ class Border
if (isset(self::$map[$index])) {
return self::$map[$index];
}
return Border::BORDER_NONE;
return StyleBorder::BORDER_NONE;
}
}

View File

@ -3,7 +3,7 @@
namespace PHPExcel\Shared;
/**
* PHPExcel_Shared_Date
* \PHPExcel\Shared\Date
*
* Copyright (c) 2006 - 2015 PHPExcel
*

View File

@ -32,7 +32,7 @@ class Escher
/**
* Drawing Group Container
*
* @var Escher\DggContainer
* @var \DggContainer
*/
private $dggContainer;

View File

@ -1,6 +1,6 @@
<?php
namespace \PHPExcel\Shared\Escher;
namespace PHPExcel\Shared\Escher;
/**
* PHPExcel_Shared_Escher_DgContainer

View File

@ -1,6 +1,6 @@
<?php
namespace \PHPExcel\Shared\Escher;
namespace PHPExcel\Shared\Escher;
/**
* PHPExcel_Shared_Escher_DggContainer

Some files were not shown because too many files have changed in this diff Show More