diff --git a/Examples/01pharSimple.php b/Examples/01pharSimple.php index 84b86cc5..c8bf45a9 100644 --- a/Examples/01pharSimple.php +++ b/Examples/01pharSimple.php @@ -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; diff --git a/Examples/01simple-download-ods.php b/Examples/01simple-download-ods.php index 30dbd7e3..50e8ef86 100644 --- a/Examples/01simple-download-ods.php +++ b/Examples/01simple-download-ods.php @@ -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; diff --git a/Examples/01simple-download-pdf.php b/Examples/01simple-download-pdf.php index 133af3a6..bec75333 100644 --- a/Examples/01simple-download-pdf.php +++ b/Examples/01simple-download-pdf.php @@ -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; diff --git a/Examples/01simple-download-xls.php b/Examples/01simple-download-xls.php index 96bb780b..49eb14f2 100644 --- a/Examples/01simple-download-xls.php +++ b/Examples/01simple-download-xls.php @@ -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; diff --git a/Examples/01simple-download-xlsx.php b/Examples/01simple-download-xlsx.php index d441f419..0c72dc09 100644 --- a/Examples/01simple-download-xlsx.php +++ b/Examples/01simple-download-xlsx.php @@ -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; diff --git a/Examples/01simplePCLZip.php b/Examples/01simplePCLZip.php index 0af4cbdd..4d74ee7a 100644 --- a/Examples/01simplePCLZip.php +++ b/Examples/01simplePCLZip.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/02types-xls.php b/Examples/02types-xls.php index 93ce17e5..82b701c8 100644 --- a/Examples/02types-xls.php +++ b/Examples/02types-xls.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/03formulas.php b/Examples/03formulas.php index 6c5d1ddc..121d866c 100644 --- a/Examples/03formulas.php +++ b/Examples/03formulas.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/04printing.php b/Examples/04printing.php index 58d5f6a8..48896a09 100644 --- a/Examples/04printing.php +++ b/Examples/04printing.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/05featuredemo.inc.php b/Examples/05featuredemo.inc.php index 003379cc..624d9228 100644 --- a/Examples/05featuredemo.inc.php +++ b/Examples/05featuredemo.inc.php @@ -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; diff --git a/Examples/05featuredemo.php b/Examples/05featuredemo.php index 9e502acb..e782bba1 100644 --- a/Examples/05featuredemo.php +++ b/Examples/05featuredemo.php @@ -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; diff --git a/Examples/06largescale-with-cellcaching-sqlite.php b/Examples/06largescale-with-cellcaching-sqlite.php index 8baa7431..c162d37e 100644 --- a/Examples/06largescale-with-cellcaching-sqlite.php +++ b/Examples/06largescale-with-cellcaching-sqlite.php @@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/06largescale-with-cellcaching-sqlite3.php b/Examples/06largescale-with-cellcaching-sqlite3.php index 1f480d1d..38a8e95d 100644 --- a/Examples/06largescale-with-cellcaching-sqlite3.php +++ b/Examples/06largescale-with-cellcaching-sqlite3.php @@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/06largescale-with-cellcaching.php b/Examples/06largescale-with-cellcaching.php index d20b29f2..d7e745d4 100644 --- a/Examples/06largescale-with-cellcaching.php +++ b/Examples/06largescale-with-cellcaching.php @@ -35,10 +35,10 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/06largescale-xls.php b/Examples/06largescale-xls.php index 5adc3d25..80233629 100644 --- a/Examples/06largescale-xls.php +++ b/Examples/06largescale-xls.php @@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/06largescale.php b/Examples/06largescale.php index cb21caf5..df7e051c 100644 --- a/Examples/06largescale.php +++ b/Examples/06largescale.php @@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/07reader.php b/Examples/07reader.php index 318ba189..756ecd52 100644 --- a/Examples/07reader.php +++ b/Examples/07reader.php @@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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); diff --git a/Examples/07readerPCLZip.php b/Examples/07readerPCLZip.php index f1da9c57..f5027397 100644 --- a/Examples/07readerPCLZip.php +++ b/Examples/07readerPCLZip.php @@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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); diff --git a/Examples/08conditionalformatting.php b/Examples/08conditionalformatting.php index 514a8bb6..92d58945 100644 --- a/Examples/08conditionalformatting.php +++ b/Examples/08conditionalformatting.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/08conditionalformatting2.php b/Examples/08conditionalformatting2.php index aeb2a313..597a46d7 100644 --- a/Examples/08conditionalformatting2.php +++ b/Examples/08conditionalformatting2.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/09pagebreaks.php b/Examples/09pagebreaks.php index 36e21ae4..783c7b1d 100644 --- a/Examples/09pagebreaks.php +++ b/Examples/09pagebreaks.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/10autofilter-selection-1.php b/Examples/10autofilter-selection-1.php index 8cdc0def..36882d80 100644 --- a/Examples/10autofilter-selection-1.php +++ b/Examples/10autofilter-selection-1.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/10autofilter-selection-2.php b/Examples/10autofilter-selection-2.php index e2aea748..8cd6d121 100644 --- a/Examples/10autofilter-selection-2.php +++ b/Examples/10autofilter-selection-2.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/10autofilter-selection-display.php b/Examples/10autofilter-selection-display.php index ba3fed9e..7fb9b7f6 100644 --- a/Examples/10autofilter-selection-display.php +++ b/Examples/10autofilter-selection-display.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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, '' ); diff --git a/Examples/10autofilter.php b/Examples/10autofilter.php index 015e9cfe..9dad0be1 100644 --- a/Examples/10autofilter.php +++ b/Examples/10autofilter.php @@ -35,11 +35,11 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/11documentsecurity-xls.php b/Examples/11documentsecurity-xls.php index 2348ce95..bb1dfa83 100644 --- a/Examples/11documentsecurity-xls.php +++ b/Examples/11documentsecurity-xls.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/11documentsecurity.php b/Examples/11documentsecurity.php index 9fd4fb2a..618c92d7 100644 --- a/Examples/11documentsecurity.php +++ b/Examples/11documentsecurity.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/12cellProtection.php b/Examples/12cellProtection.php index e12c9ae4..c266c042 100644 --- a/Examples/12cellProtection.php +++ b/Examples/12cellProtection.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/13calculation.php b/Examples/13calculation.php index e255d115..a3b34281 100644 --- a/Examples/13calculation.php +++ b/Examples/13calculation.php @@ -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 diff --git a/Examples/13calculationCyclicFormulae.php b/Examples/13calculationCyclicFormulae.php index 8512a3e8..b553efeb 100644 --- a/Examples/13calculationCyclicFormulae.php +++ b/Examples/13calculationCyclicFormulae.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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 diff --git a/Examples/14excel5.php b/Examples/14excel5.php index 7a9f6856..b35a2aae 100644 --- a/Examples/14excel5.php +++ b/Examples/14excel5.php @@ -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; diff --git a/Examples/15datavalidation-xls.php b/Examples/15datavalidation-xls.php index 22ed6265..d3a7fd8a 100644 --- a/Examples/15datavalidation-xls.php +++ b/Examples/15datavalidation-xls.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/15datavalidation.php b/Examples/15datavalidation.php index e6688c5f..3c41387b 100644 --- a/Examples/15datavalidation.php +++ b/Examples/15datavalidation.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/16csv.php b/Examples/16csv.php index 8d42fcbb..f6bea48c 100644 --- a/Examples/16csv.php +++ b/Examples/16csv.php @@ -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); diff --git a/Examples/17html.php b/Examples/17html.php index b84f8d4e..322848fa 100644 --- a/Examples/17html.php +++ b/Examples/17html.php @@ -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__)); diff --git a/Examples/18extendedcalculation.php b/Examples/18extendedcalculation.php index 59aeb300..3edfd0e6 100644 --- a/Examples/18extendedcalculation.php +++ b/Examples/18extendedcalculation.php @@ -36,17 +36,17 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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"; diff --git a/Examples/19namedrange.php b/Examples/19namedrange.php index 7876ea58..01d0d524 100644 --- a/Examples/19namedrange.php +++ b/Examples/19namedrange.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/20readexcel5.php b/Examples/20readexcel5.php index 7625c7b8..b6ba2c1f 100644 --- a/Examples/20readexcel5.php +++ b/Examples/20readexcel5.php @@ -35,8 +35,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/21pdf.php b/Examples/21pdf.php index b26ddb8b..180b2cb9 100644 --- a/Examples/21pdf.php +++ b/Examples/21pdf.php @@ -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); diff --git a/Examples/22heavilyformatted.php b/Examples/22heavilyformatted.php index 98c7d184..c97731a0 100644 --- a/Examples/22heavilyformatted.php +++ b/Examples/22heavilyformatted.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/23sharedstyles.php b/Examples/23sharedstyles.php index 22eadba1..a60c68dd 100644 --- a/Examples/23sharedstyles.php +++ b/Examples/23sharedstyles.php @@ -36,12 +36,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/24readfilter.php b/Examples/24readfilter.php index 000d180a..91c11ced 100644 --- a/Examples/24readfilter.php +++ b/Examples/24readfilter.php @@ -33,8 +33,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/25inmemoryimage.php b/Examples/25inmemoryimage.php index 6c3b0b84..b170c3db 100644 --- a/Examples/25inmemoryimage.php +++ b/Examples/25inmemoryimage.php @@ -35,12 +35,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/26utf8.php b/Examples/26utf8.php index 112c5c73..7c374062 100644 --- a/Examples/26utf8.php +++ b/Examples/26utf8.php @@ -35,14 +35,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/27imagesexcel5.php b/Examples/27imagesexcel5.php index a4f6a9d7..464812c1 100644 --- a/Examples/27imagesexcel5.php +++ b/Examples/27imagesexcel5.php @@ -35,23 +35,23 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/28iterator.php b/Examples/28iterator.php index 92c4192a..3267c35e 100644 --- a/Examples/28iterator.php +++ b/Examples/28iterator.php @@ -34,16 +34,15 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/29advancedvaluebinder.php b/Examples/29advancedvaluebinder.php index a172c6cd..77becc6e 100644 --- a/Examples/29advancedvaluebinder.php +++ b/Examples/29advancedvaluebinder.php @@ -33,7 +33,7 @@ ini_set('display_startup_errors', TRUE); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/30template.php b/Examples/30template.php index db9cbb45..38e039e8 100644 --- a/Examples/30template.php +++ b/Examples/30template.php @@ -34,13 +34,13 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/31docproperties_write-xls.php b/Examples/31docproperties_write-xls.php index e9a5e876..18c3d540 100644 --- a/Examples/31docproperties_write-xls.php +++ b/Examples/31docproperties_write-xls.php @@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/31docproperties_write.php b/Examples/31docproperties_write.php index 4cd47795..094f1611 100644 --- a/Examples/31docproperties_write.php +++ b/Examples/31docproperties_write.php @@ -35,7 +35,7 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/32chartreadwrite.php b/Examples/32chartreadwrite.php index 5aeedcae..97a72a9d 100644 --- a/Examples/32chartreadwrite.php +++ b/Examples/32chartreadwrite.php @@ -10,37 +10,8 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/33chartcreate-area.php b/Examples/33chartcreate-area.php index fac8ce93..394c2ada 100644 --- a/Examples/33chartcreate-area.php +++ b/Examples/33chartcreate-area.php @@ -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; diff --git a/Examples/33chartcreate-bar-stacked.php b/Examples/33chartcreate-bar-stacked.php index af9493f7..0df7e339 100644 --- a/Examples/33chartcreate-bar-stacked.php +++ b/Examples/33chartcreate-bar-stacked.php @@ -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; diff --git a/Examples/33chartcreate-bar.php b/Examples/33chartcreate-bar.php index 653675d6..252c2865 100644 --- a/Examples/33chartcreate-bar.php +++ b/Examples/33chartcreate-bar.php @@ -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; diff --git a/Examples/33chartcreate-column-2.php b/Examples/33chartcreate-column-2.php index 0ade332c..b56dc823 100644 --- a/Examples/33chartcreate-column-2.php +++ b/Examples/33chartcreate-column-2.php @@ -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; diff --git a/Examples/33chartcreate-column.php b/Examples/33chartcreate-column.php index 67f41784..31adddec 100644 --- a/Examples/33chartcreate-column.php +++ b/Examples/33chartcreate-column.php @@ -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; diff --git a/Examples/33chartcreate-composite.php b/Examples/33chartcreate-composite.php index be7ad94a..a447068c 100644 --- a/Examples/33chartcreate-composite.php +++ b/Examples/33chartcreate-composite.php @@ -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; diff --git a/Examples/33chartcreate-line.php b/Examples/33chartcreate-line.php index 90c2e60c..99022890 100644 --- a/Examples/33chartcreate-line.php +++ b/Examples/33chartcreate-line.php @@ -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; diff --git a/Examples/33chartcreate-multiple-charts.php b/Examples/33chartcreate-multiple-charts.php index 0e5ac60e..b597ee4c 100644 --- a/Examples/33chartcreate-multiple-charts.php +++ b/Examples/33chartcreate-multiple-charts.php @@ -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; diff --git a/Examples/33chartcreate-pie.php b/Examples/33chartcreate-pie.php index 78b6293f..37e8a665 100644 --- a/Examples/33chartcreate-pie.php +++ b/Examples/33chartcreate-pie.php @@ -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; diff --git a/Examples/33chartcreate-radar.php b/Examples/33chartcreate-radar.php index 0c28addf..d32e2c98 100644 --- a/Examples/33chartcreate-radar.php +++ b/Examples/33chartcreate-radar.php @@ -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; diff --git a/Examples/33chartcreate-scatter.php b/Examples/33chartcreate-scatter.php index 7fc5b5ad..ca742d85 100644 --- a/Examples/33chartcreate-scatter.php +++ b/Examples/33chartcreate-scatter.php @@ -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; diff --git a/Examples/33chartcreate-stock.php b/Examples/33chartcreate-stock.php index 465107b3..b05b9f41 100644 --- a/Examples/33chartcreate-stock.php +++ b/Examples/33chartcreate-stock.php @@ -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)) { diff --git a/Examples/34chartupdate.php b/Examples/34chartupdate.php index f4b36c6b..66fd0d12 100644 --- a/Examples/34chartupdate.php +++ b/Examples/34chartupdate.php @@ -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; diff --git a/Examples/35chartrender.php b/Examples/35chartrender.php index 62719e51..26b591c7 100644 --- a/Examples/35chartrender.php +++ b/Examples/35chartrender.php @@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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); diff --git a/Examples/36chartreadwriteHTML.php b/Examples/36chartreadwriteHTML.php index 7fc26fde..4eb8db17 100644 --- a/Examples/36chartreadwriteHTML.php +++ b/Examples/36chartreadwriteHTML.php @@ -10,47 +10,18 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/36chartreadwritePDF.php b/Examples/36chartreadwritePDF.php index 24d1c857..8e47859d 100644 --- a/Examples/36chartreadwritePDF.php +++ b/Examples/36chartreadwritePDF.php @@ -10,51 +10,22 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/37page_layout_view.php b/Examples/37page_layout_view.php index 810ca3d2..edd4a60b 100644 --- a/Examples/37page_layout_view.php +++ b/Examples/37page_layout_view.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/38cloneWorksheet.php b/Examples/38cloneWorksheet.php index 245f7da4..7cf559be 100644 --- a/Examples/38cloneWorksheet.php +++ b/Examples/38cloneWorksheet.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/39dropdown.php b/Examples/39dropdown.php index c8dcff67..a67cecf8 100644 --- a/Examples/39dropdown.php +++ b/Examples/39dropdown.php @@ -34,12 +34,12 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); /** 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; diff --git a/Examples/40duplicateStyle.php b/Examples/40duplicateStyle.php index be31951a..28439b12 100644 --- a/Examples/40duplicateStyle.php +++ b/Examples/40duplicateStyle.php @@ -10,16 +10,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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; diff --git a/Examples/41password.php b/Examples/41password.php index 15aea7ba..624d59c2 100644 --- a/Examples/41password.php +++ b/Examples/41password.php @@ -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; diff --git a/Examples/43mergeWorkbooks.php b/Examples/43mergeWorkbooks.php index 465b60a3..990c7561 100644 --- a/Examples/43mergeWorkbooks.php +++ b/Examples/43mergeWorkbooks.php @@ -33,14 +33,14 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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); diff --git a/Examples/44worksheetInfo.php b/Examples/44worksheetInfo.php index 5aeefcbd..c976a68b 100644 --- a/Examples/44worksheetInfo.php +++ b/Examples/44worksheetInfo.php @@ -33,17 +33,16 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); 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); diff --git a/Examples/Excel2003XMLReader.php b/Examples/Excel2003XMLReader.php index e77f8a97..3bf352a5 100644 --- a/Examples/Excel2003XMLReader.php +++ b/Examples/Excel2003XMLReader.php @@ -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; diff --git a/Examples/GnumericReader.php b/Examples/GnumericReader.php index 1b22e2cb..d839eb1a 100644 --- a/Examples/GnumericReader.php +++ b/Examples/GnumericReader.php @@ -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; diff --git a/Examples/OOCalcReader.php b/Examples/OOCalcReader.php index 70f36063..1436cdf3 100644 --- a/Examples/OOCalcReader.php +++ b/Examples/OOCalcReader.php @@ -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; diff --git a/Examples/OOCalcReaderPCLZip.php b/Examples/OOCalcReaderPCLZip.php index 2fc771cd..3d1d23a0 100644 --- a/Examples/OOCalcReaderPCLZip.php +++ b/Examples/OOCalcReaderPCLZip.php @@ -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; diff --git a/Examples/Quadratic.php b/Examples/Quadratic.php index 11a712e5..dec9fb6e 100644 --- a/Examples/Quadratic.php +++ b/Examples/Quadratic.php @@ -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']); diff --git a/Examples/SylkReader.php b/Examples/SylkReader.php index a16a4f05..75cb03ce 100644 --- a/Examples/SylkReader.php +++ b/Examples/SylkReader.php @@ -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; diff --git a/Examples/XMLReader.php b/Examples/XMLReader.php index 836f6b2d..d7b3b8a3 100644 --- a/Examples/XMLReader.php +++ b/Examples/XMLReader.php @@ -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; diff --git a/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php b/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php index f6c4c0e2..fe6b41df 100644 --- a/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php +++ b/src/PhpSpreadsheet/CachedObjectStorage/SQLite3.php @@ -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()); } diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 2b12ee7d..e1a99144 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -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; } diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index a5aaafbd..40cbdf78 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -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); } diff --git a/src/PhpSpreadsheet/NamedRange.php b/src/PhpSpreadsheet/NamedRange.php index 672997c4..c8048889 100644 --- a/src/PhpSpreadsheet/NamedRange.php +++ b/src/PhpSpreadsheet/NamedRange.php @@ -3,7 +3,7 @@ namespace PHPExcel; /** - * PHPExcel_NamedRange + * PHPExcel\NamedRange * * Copyright (c) 2006 - 2015 PHPExcel * diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index a6e0d0be..76ea6f1d 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -1,6 +1,7 @@ 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) ); } @@ -1560,7 +1560,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(); @@ -1654,9 +1654,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(); @@ -1670,12 +1670,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"); @@ -1875,7 +1875,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, '
'; // var_dump($charts[$chartEntryRef]); diff --git a/src/PhpSpreadsheet/Reader/Excel5.php b/src/PhpSpreadsheet/Reader/Excel5.php index 5af188f4..df4e3ba2 100644 --- a/src/PhpSpreadsheet/Reader/Excel5.php +++ b/src/PhpSpreadsheet/Reader/Excel5.php @@ -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 diff --git a/src/PhpSpreadsheet/Reader/Excel5/Escher.php b/src/PhpSpreadsheet/Reader/Excel5/Escher.php index 9e702193..2930d23a 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Escher.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Escher.php @@ -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); diff --git a/src/PhpSpreadsheet/Shared/Escher.php b/src/PhpSpreadsheet/Shared/Escher.php index b9039a16..49316ff6 100644 --- a/src/PhpSpreadsheet/Shared/Escher.php +++ b/src/PhpSpreadsheet/Shared/Escher.php @@ -32,7 +32,7 @@ class Escher /** * Drawing Group Container * - * @var Escher\DggContainer + * @var \DggContainer */ private $dggContainer; diff --git a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php index ebdd1cae..85901a5d 100644 --- a/src/PhpSpreadsheet/Shared/Escher/DgContainer.php +++ b/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -1,6 +1,6 @@ calculateCellValues = $calculateCellValues; @@ -112,12 +120,12 @@ class Chart extends WriterPart /** * Write Chart Title * - * @param PHPExcel_Chart_Title $title + * @param Title $title * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception */ - private function writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) + private function writeTitle(Title $title = null, $objWriter) { if (is_null($title)) { return; @@ -157,12 +165,12 @@ class Chart extends WriterPart /** * Write Chart Legend * - * @param PHPExcel_Chart_Legend $legend + * @param Legend $legend * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception */ - private function writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) + private function writeLegend(Legend $legend = null, $objWriter) { if (is_null($legend)) { return; @@ -208,16 +216,16 @@ class Chart extends WriterPart /** * Write Chart Plot Area * - * @param PHPExcel_Chart_PlotArea $plotArea - * @param PHPExcel_Chart_Title $xAxisLabel - * @param PHPExcel_Chart_Title $yAxisLabel - * @param PHPExcel_Chart_Axis $xAxis - * @param PHPExcel_Chart_Axis $yAxis + * @param PlotArea $plotArea + * @param Title $xAxisLabel + * @param Title $yAxisLabel + * @param Axis $xAxis + * @param Axis $yAxis * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception */ - private function writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, \PHPExcel\Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines) + private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis, Axis $yAxis, GridLines $majorGridlines, GridLines $minorGridlines) { if (is_null($plotArea)) { return; @@ -243,11 +251,11 @@ class Chart extends WriterPart $groupType = $plotGroup->getPlotType(); if ($groupType == $chartType) { $plotStyle = $plotGroup->getPlotStyle(); - if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) { + if ($groupType === DataSeries::TYPE_RADARCHART) { $objWriter->startElement('c:radarStyle'); $objWriter->writeAttribute('val', $plotStyle); $objWriter->endElement(); - } elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) { + } elseif ($groupType === DataSeries::TYPE_SCATTERCHART) { $objWriter->startElement('c:scatterStyle'); $objWriter->writeAttribute('val', $plotStyle); $objWriter->endElement(); @@ -259,13 +267,13 @@ class Chart extends WriterPart $this->writeDataLabels($objWriter, $layout); - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) { + if ($chartType === DataSeries::TYPE_LINECHART) { // Line only, Line3D can't be smoothed $objWriter->startElement('c:smooth'); $objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine()); $objWriter->endElement(); - } elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) { + } elseif (($chartType === DataSeries::TYPE_BARCHART) ||($chartType === DataSeries::TYPE_BARCHART_3D)) { $objWriter->startElement('c:gapWidth'); $objWriter->writeAttribute('val', 150); $objWriter->endElement(); @@ -275,7 +283,7 @@ class Chart extends WriterPart $objWriter->writeAttribute('val', 100); $objWriter->endElement(); } - } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + } elseif ($chartType === DataSeries::TYPE_BUBBLECHART) { $objWriter->startElement('c:bubbleScale'); $objWriter->writeAttribute('val', 25); $objWriter->endElement(); @@ -283,7 +291,7 @@ class Chart extends WriterPart $objWriter->startElement('c:showNegBubbles'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); - } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) { + } elseif ($chartType === DataSeries::TYPE_STOCKCHART) { $objWriter->startElement('c:hiLowLines'); $objWriter->endElement(); @@ -310,7 +318,7 @@ class Chart extends WriterPart $id1 = '75091328'; $id2 = '75089408'; - if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) { $objWriter->startElement('c:axId'); $objWriter->writeAttribute('val', $id1); $objWriter->endElement(); @@ -322,7 +330,7 @@ class Chart extends WriterPart $objWriter->writeAttribute('val', 0); $objWriter->endElement(); - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) { + if ($chartType === DataSeries::TYPE_DONUTCHART) { $objWriter->startElement('c:holeSize'); $objWriter->writeAttribute('val', 50); $objWriter->endElement(); @@ -332,8 +340,8 @@ class Chart extends WriterPart $objWriter->endElement(); } - if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { - if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) { + if ($chartType === DataSeries::TYPE_BUBBLECHART) { $this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines); } else { $this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis); @@ -399,7 +407,7 @@ class Chart extends WriterPart * Write Category Axis * * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer - * @param PHPExcel_Chart_PlotArea $plotArea + * @param PlotArea $plotArea * @param PHPExcel_Chart_Title $xAxisLabel * @param string $groupType Chart type * @param string $id1 @@ -408,7 +416,7 @@ class Chart extends WriterPart * * @throws \PHPExcel\Writer\Exception */ - private function writeCategoryAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) + private function writeCategoryAxis($objWriter, PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) { $objWriter->startElement('c:catAx'); @@ -530,7 +538,7 @@ class Chart extends WriterPart * * @throws \PHPExcel\Writer\Exception */ - private function writeValueAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) + private function writeValueAxis($objWriter, PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) { $objWriter->startElement('c:valAx'); @@ -809,7 +817,7 @@ class Chart extends WriterPart $objWriter->endElement(); $objWriter->endElement(); - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType !== DataSeries::TYPE_BUBBLECHART) { $layout = $yAxisLabel->getLayout(); $this->writeLayout($layout, $objWriter); } @@ -993,7 +1001,7 @@ class Chart extends WriterPart } if ($isMultiLevelSeries) { - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType !== DataSeries::TYPE_BUBBLECHART) { $objWriter->startElement('c:noMultiLvlLbl'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); @@ -1034,7 +1042,7 @@ class Chart extends WriterPart /** * Write Plot Group (series of related plots) * - * @param PHPExcel_Chart_DataSeries $plotGroup + * @param DataSeries $plotGroup * @param string $groupType Type of plot for dataseries * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param boolean &$catIsMultiLevelSeries Is category a multi-series category @@ -1050,7 +1058,7 @@ class Chart extends WriterPart return; } - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) { + if (($groupType == DataSeries::TYPE_BARCHART) || ($groupType == DataSeries::TYPE_BARCHART_3D)) { $objWriter->startElement('c:barDir'); $objWriter->writeAttribute('val', $plotGroup->getPlotDirection()); $objWriter->endElement(); @@ -1067,9 +1075,9 @@ class Chart extends WriterPart $plotSeriesOrder = $plotGroup->getPlotOrder(); $plotSeriesCount = count($plotSeriesOrder); - if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) { - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) { - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) { + if (($groupType !== DataSeries::TYPE_RADARCHART) && ($groupType !== DataSeries::TYPE_STOCKCHART)) { + if ($groupType !== DataSeries::TYPE_LINECHART) { + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) { $objWriter->startElement('c:varyColors'); $objWriter->writeAttribute('val', 1); $objWriter->endElement(); @@ -1092,7 +1100,7 @@ class Chart extends WriterPart $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef); $objWriter->endElement(); - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) { $objWriter->startElement('c:dPt'); $objWriter->startElement('c:idx'); $objWriter->writeAttribute('val', 3); @@ -1123,11 +1131,11 @@ class Chart extends WriterPart } // Formatting for the points - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) { + if (($groupType == DataSeries::TYPE_LINECHART) || ($groupType == DataSeries::TYPE_STOCKCHART)) { $objWriter->startElement('c:spPr'); $objWriter->startElement('a:ln'); $objWriter->writeAttribute('w', 12700); - if ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) { + if ($groupType == DataSeries::TYPE_STOCKCHART) { $objWriter->startElement('a:noFill'); $objWriter->endElement(); } @@ -1154,7 +1162,7 @@ class Chart extends WriterPart } } - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) { + if (($groupType === DataSeries::TYPE_BARCHART) || ($groupType === DataSeries::TYPE_BARCHART_3D) || ($groupType === DataSeries::TYPE_BUBBLECHART)) { $objWriter->startElement('c:invertIfNegative'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); @@ -1165,7 +1173,7 @@ class Chart extends WriterPart if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) { $catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries(); - if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) { if (!is_null($plotGroup->getPlotStyle())) { $plotStyle = $plotGroup->getPlotStyle(); if ($plotStyle) { @@ -1176,7 +1184,7 @@ class Chart extends WriterPart } } - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) { + if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) { $objWriter->startElement('c:xVal'); } else { $objWriter->startElement('c:cat'); @@ -1190,7 +1198,7 @@ class Chart extends WriterPart if ($plotSeriesValues) { $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries(); - if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) { + if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) { $objWriter->startElement('c:yVal'); } else { $objWriter->startElement('c:val'); @@ -1200,7 +1208,7 @@ class Chart extends WriterPart $objWriter->endElement(); } - if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { + if ($groupType === DataSeries::TYPE_BUBBLECHART) { $this->writeBubbles($plotSeriesValues, $objWriter, $pSheet); } @@ -1213,7 +1221,7 @@ class Chart extends WriterPart /** * Write Plot Series Label * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel + * @param DataSeriesValues $plotSeriesLabel * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception @@ -1248,7 +1256,7 @@ class Chart extends WriterPart /** * Write Plot Series Values * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues + * @param DataSeriesValues $plotSeriesValues * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $groupType Type of plot for dataseries * @param string $dataType Datatype of series values @@ -1307,7 +1315,7 @@ class Chart extends WriterPart $objWriter->startElement('c:' . $dataType . 'Cache'); - if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { + if (($groupType != DataSeries::TYPE_PIECHART) && ($groupType != DataSeries::TYPE_PIECHART_3D) && ($groupType != DataSeries::TYPE_DONUTCHART)) { if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) { $objWriter->startElement('c:formatCode'); $objWriter->writeRawData($plotSeriesValues->getFormatCode()); @@ -1343,7 +1351,7 @@ class Chart extends WriterPart /** * Write Bubble Chart Details * - * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues + * @param DataSeriesValues $plotSeriesValues * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception @@ -1390,12 +1398,12 @@ class Chart extends WriterPart /** * Write Layout * - * @param PHPExcel_Chart_Layout $layout + * @param Layout $layout * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * * @throws \PHPExcel\Writer\Exception */ - private function writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) + private function writeLayout(Layout $layout = null, $objWriter) { $objWriter->startElement('c:layout'); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php b/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php index 7e3c3126..0573b46b 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php @@ -1,5 +1,6 @@ getTopLeftPosition(); $tl['colRow'] = \PHPExcel\Cell::coordinateFromString($tl['cell']); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php index 7134efcb..8df8190e 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php @@ -306,10 +306,10 @@ class Workbook extends WriterPart * Write Defined Name for named range * * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer - * @param PHPExcel_NamedRange $pNamedRange + * @param \PHPExcel\NamedRange $pNamedRange * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNameForNamedRange(\PHPExcel\Shared\XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) + private function writeDefinedNameForNamedRange(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\NamedRange $pNamedRange) { // definedName for named range $objWriter->startElement('definedName'); diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php index 5d82885b..fe328758 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/HTML.php @@ -1,6 +1,10 @@ phpExcel = $phpExcel; $this->defaultFont = $this->phpExcel->getDefaultStyle()->getFont(); @@ -149,10 +153,10 @@ class HTML extends BaseWriter implements IWriter // garbage collect $this->phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); - PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + $saveDebugLog = Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); + $saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); // Build CSS $this->buildCSS(!$this->useInlineCss); @@ -180,8 +184,8 @@ class HTML extends BaseWriter implements IWriter // Close file fclose($fileHandle); - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); + Calculation::setArrayReturnType($saveArrayReturnType); + Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -423,10 +427,10 @@ class HTML extends BaseWriter implements IWriter // Get worksheet dimension $dimension = explode(':', $sheet->calculateWorksheetDimension()); - $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]); - $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1; - $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]); - $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1; + $dimension[0] = \PHPExcel\Cell::coordinateFromString($dimension[0]); + $dimension[0][0] = \PHPExcel\Cell::columnIndexFromString($dimension[0][0]) - 1; + $dimension[1] = \PHPExcel\Cell::coordinateFromString($dimension[1]); + $dimension[1][0] = \PHPExcel\Cell::columnIndexFromString($dimension[1][0]) - 1; // row min,max $rowMin = $dimension[0][1]; @@ -470,7 +474,7 @@ class HTML extends BaseWriter implements IWriter while ($column++ < $dimension[1][0]) { // Cell exists? if ($sheet->cellExistsByColumnAndRow($column, $row)) { - $rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row; + $rowData[$column] = \PHPExcel\Cell::stringFromColumnIndex($column) . $row; } else { $rowData[$column] = ''; } @@ -555,11 +559,11 @@ class HTML extends BaseWriter implements IWriter foreach ($pSheet->getChartCollection() as $chart) { if ($chart instanceof PHPExcel_Chart) { $chartCoordinates = $chart->getTopLeftPosition(); - $chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']); - $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]); + $chartTL = \PHPExcel\Cell::coordinateFromString($chartCoordinates['cell']); + $chartCol = \PHPExcel\Cell::columnIndexFromString($chartTL[0]); if ($chartTL[1] > $rowMax) { $rowMax = $chartTL[1]; - if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + if ($chartCol > \PHPExcel\Cell::columnIndexFromString($colMax)) { $colMax = $chartTL[0]; } } @@ -569,11 +573,11 @@ class HTML extends BaseWriter implements IWriter foreach ($pSheet->getDrawingCollection() as $drawing) { if ($drawing instanceof \PHPExcel\Worksheet\Drawing) { - $imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates()); - $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]); + $imageTL = \PHPExcel\Cell::coordinateFromString($drawing->getCoordinates()); + $imageCol = \PHPExcel\Cell::columnIndexFromString($imageTL[0]); if ($imageTL[1] > $rowMax) { $rowMax = $imageTL[1]; - if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + if ($imageCol > \PHPExcel\Cell::columnIndexFromString($colMax)) { $colMax = $imageTL[0]; } } @@ -856,7 +860,7 @@ class HTML extends BaseWriter implements IWriter $sheet->calculateColumnWidths(); // col elements, initialize - $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; + $highestColumnIndex = \PHPExcel\Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; $column = -1; while ($column++ < $highestColumnIndex) { $this->columnWidths[$sheetIndex][$column] = 42; // approximation @@ -867,7 +871,7 @@ class HTML extends BaseWriter implements IWriter foreach ($sheet->getColumnDimensions() as $columnDimension) { if (($width = \PHPExcel\Shared\Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) { $width = \PHPExcel\Shared\Drawing::pixelsToPoints($width); - $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; + $column = \PHPExcel\Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; $this->columnWidths[$sheetIndex][$column] = $width; $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; @@ -885,7 +889,7 @@ class HTML extends BaseWriter implements IWriter $css['table.sheet' . $sheetIndex . ' tr'] = array(); if ($rowDimension->getRowHeight() == -1) { - $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont()); + $pt_height = Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont()); } else { $pt_height = $rowDimension->getRowHeight(); } @@ -903,7 +907,7 @@ class HTML extends BaseWriter implements IWriter $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array(); if ($rowDimension->getRowHeight() == -1) { - $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont()); + $pt_height = Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont()); } else { $pt_height = $rowDimension->getRowHeight(); } @@ -1102,7 +1106,7 @@ class HTML extends BaseWriter implements IWriter } // Write elements - $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; + $highestColumnIndex = \PHPExcel\Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; $i = -1; while ($i++ < $highestColumnIndex) { if (!$this->isPdf) { @@ -1180,7 +1184,7 @@ class HTML extends BaseWriter implements IWriter $colNum = 0; foreach ($pValues as $cellAddress) { $cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : ''; - $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1); + $coordinate = \PHPExcel\Cell::stringFromColumnIndex($colNum) . ($pRow + 1); if (!$this->useInlineCss) { $cssClass = ''; $cssClass = 'column' . $colNum; @@ -1202,8 +1206,8 @@ class HTML extends BaseWriter implements IWriter // initialize $cellData = ' '; - // PHPExcel_Cell - if ($cell instanceof PHPExcel_Cell) { + // \PHPExcel\Cell + if ($cell instanceof \PHPExcel\Cell) { $cellData = ''; if (is_null($cell->getParent())) { $cell->attach($pSheet); @@ -1310,7 +1314,7 @@ class HTML extends BaseWriter implements IWriter // Also apply style from last cell in merge to fix borders - // relies on !important for non-none border declarations in createCSSStyleBorder - $endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan); + $endCellCoord = \PHPExcel\Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan); if (!$this->useInlineCss) { $cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex(); } @@ -1515,15 +1519,15 @@ class HTML extends BaseWriter implements IWriter // loop through all Excel merged cells foreach ($sheet->getMergeCells() as $cells) { - list($cells,) = PHPExcel_Cell::splitRange($cells); + list($cells,) = \PHPExcel\Cell::splitRange($cells); $first = $cells[0]; $last = $cells[1]; - list($fc, $fr) = PHPExcel_Cell::coordinateFromString($first); - $fc = PHPExcel_Cell::columnIndexFromString($fc) - 1; + list($fc, $fr) = \PHPExcel\Cell::coordinateFromString($first); + $fc = \PHPExcel\Cell::columnIndexFromString($fc) - 1; - list($lc, $lr) = PHPExcel_Cell::coordinateFromString($last); - $lc = PHPExcel_Cell::columnIndexFromString($lc) - 1; + list($lc, $lr) = \PHPExcel\Cell::coordinateFromString($last); + $lc = \PHPExcel\Cell::columnIndexFromString($lc) - 1; // loop through the individual cells in the individual merge $r = $fr - 1; @@ -1553,7 +1557,7 @@ class HTML extends BaseWriter implements IWriter // Identify which rows should be omitted in HTML. These are the rows where all the cells // participate in a merge and the where base cells are somewhere above. - $countColumns = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()); + $countColumns = \PHPExcel\Cell::columnIndexFromString($sheet->getHighestColumn()); foreach ($candidateSpannedRow as $rowIndex) { if (isset($this->isSpannedCell[$sheetIndex][$rowIndex])) { if (count($this->isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) { @@ -1592,16 +1596,16 @@ class HTML extends BaseWriter implements IWriter $htmlPage = '@page { '; $htmlBody = 'body { '; - $left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; + $left = String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; $htmlPage .= 'margin-left: ' . $left; $htmlBody .= 'margin-left: ' . $left; - $right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; + $right = String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; $htmlPage .= 'margin-right: ' . $right; $htmlBody .= 'margin-right: ' . $right; - $top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; + $top = String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; $htmlPage .= 'margin-top: ' . $top; $htmlBody .= 'margin-top: ' . $top; - $bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; + $bottom = String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; $htmlPage .= 'margin-bottom: ' . $bottom; $htmlBody .= 'margin-bottom: ' . $bottom;