From 03f053bf77c13b5fd36f1411fb7ddb3e70a8f007 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 18 Mar 2016 11:18:31 +0100 Subject: [PATCH 1/5] Fix PHPCS Error --- src/PhpSpreadsheet/Reader/Excel5/Color/BIFF8.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF8.php b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF8.php index 445b43d7..395b0cbf 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF8.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF8.php @@ -76,4 +76,4 @@ class BIFF8 } return array('rgb' => '000000'); } -} \ No newline at end of file +} From 114fc007636a90f083c6a5f68b8ec00c519677e7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 22 Mar 2016 10:08:48 +0100 Subject: [PATCH 2/5] Fix some PHPCS errors --- src/PhpSpreadsheet/Calculation/MathTrig.php | 45 ++++++++++--------- src/PhpSpreadsheet/Helper/HTML.php | 2 +- .../Reader/Excel5/Color/BIFF5.php | 2 +- .../Reader/Excel5/Color/BuiltIn.php | 2 +- .../Reader/Excel5/ErrorCode.php | 2 +- .../Reader/Excel5/Style/Border.php | 34 +++++++------- .../Reader/Excel5/Style/FillPattern.php | 2 +- src/PhpSpreadsheet/Shared/CodePage.php | 14 +++--- src/PhpSpreadsheet/Shared/ZipArchive.php | 3 +- src/PhpSpreadsheet/Spreadsheet.php | 4 +- src/PhpSpreadsheet/Style/NumberFormat.php | 8 ++-- .../Writer/Excel2007/ContentTypes.php | 4 +- src/PhpSpreadsheet/Writer/Excel2007/Theme.php | 2 + .../Writer/Excel2007/Worksheet.php | 1 + .../Writer/Excel5/Worksheet.php | 3 +- src/PhpSpreadsheet/Writer/HTML.php | 4 +- src/PhpSpreadsheet/Writer/OpenDocument.php | 4 +- .../Writer/OpenDocument/Cell/Comment.php | 5 ++- .../Writer/OpenDocument/Content.php | 5 ++- .../Writer/OpenDocument/Meta.php | 4 +- .../Writer/OpenDocument/MetaInf.php | 4 +- .../Writer/OpenDocument/Mimetype.php | 4 +- .../Writer/OpenDocument/Settings.php | 4 +- .../Writer/OpenDocument/Styles.php | 4 +- .../Writer/OpenDocument/Thumbnails.php | 4 +- .../Writer/OpenDocument/WriterPart.php | 4 +- 26 files changed, 103 insertions(+), 71 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 45a32da0..8a4310cb 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -1212,27 +1212,28 @@ class MathTrig return $returnValue; } - /** - * SUMIFS - * - * Counts the number of cells that contain numbers within the list of arguments - * - * Excel Function: - * SUMIFS(value1[,value2[, ...]],condition) - * - * @access public - * @category Mathematical and Trigonometric Functions - * @param mixed $arg,... Data values - * @param string $condition The criteria that defines which cells will be summed. - * @return float - */ - public static function SUMIFS() { - $arrayList = func_get_args(); + /** + * SUMIFS + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * SUMIFS(value1[,value2[, ...]],condition) + * + * @access public + * @category Mathematical and Trigonometric Functions + * @param mixed $arg,... Data values + * @param string $condition The criteria that defines which cells will be summed. + * @return float + */ + public static function SUMIFS() + { + $arrayList = func_get_args(); - // Return value - $returnValue = 0; + // Return value + $returnValue = 0; - $sumArgs = Functions::flattenArray(array_shift($arrayList)); + $sumArgs = Functions::flattenArray(array_shift($arrayList)); while (count($arrayList) > 0) { $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); @@ -1256,9 +1257,9 @@ class MathTrig } } - // Return - return $returnValue; - } + // Return + return $returnValue; + } /** * SUMPRODUCT diff --git a/src/PhpSpreadsheet/Helper/HTML.php b/src/PhpSpreadsheet/Helper/HTML.php index 703bf20b..8e7de536 100644 --- a/src/PhpSpreadsheet/Helper/HTML.php +++ b/src/PhpSpreadsheet/Helper/HTML.php @@ -634,7 +634,7 @@ class HTML protected function cleanWhitespace() { - foreach($this->richTextObject->getRichTextElements() as $key => $element) { + foreach ($this->richTextObject->getRichTextElements() as $key => $element) { $text = $element->getText(); // Trim any leading spaces on the first run if ($key == 0) { diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php index 89f83fd2..67985721 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Color/BIFF5.php @@ -76,4 +76,4 @@ class BIFF5 } return array('rgb' => '000000'); } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php b/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php index 237a1e8c..bb7adb85 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Color/BuiltIn.php @@ -30,4 +30,4 @@ class BuiltIn } return array('rgb' => '000000'); } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php b/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php index b9996ed1..79e28f39 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php +++ b/src/PhpSpreadsheet/Reader/Excel5/ErrorCode.php @@ -27,4 +27,4 @@ class ErrorCode } return false; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php b/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php index 6cb07bfe..9d63aa07 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Style/Border.php @@ -2,25 +2,25 @@ namespace PHPExcel\Reader\Excel5\Style; -use \PHPExcel\Style\Border; +use \PHPExcel\Style\Border as StyleBorder; class Border { protected static $map = array( - 0x00 => Border::BORDER_NONE, - 0x01 => Border::BORDER_THIN, - 0x02 => Border::BORDER_MEDIUM, - 0x03 => Border::BORDER_DASHED, - 0x04 => Border::BORDER_DOTTED, - 0x05 => Border::BORDER_THICK, - 0x06 => Border::BORDER_DOUBLE, - 0x07 => Border::BORDER_HAIR, - 0x08 => Border::BORDER_MEDIUMDASHED, - 0x09 => Border::BORDER_DASHDOT, - 0x0A => Border::BORDER_MEDIUMDASHDOT, - 0x0B => Border::BORDER_DASHDOTDOT, - 0x0C => Border::BORDER_MEDIUMDASHDOTDOT, - 0x0D => Border::BORDER_SLANTDASHDOT, + 0x00 => StyleBorder::BORDER_NONE, + 0x01 => StyleBorder::BORDER_THIN, + 0x02 => StyleBorder::BORDER_MEDIUM, + 0x03 => StyleBorder::BORDER_DASHED, + 0x04 => StyleBorder::BORDER_DOTTED, + 0x05 => StyleBorder::BORDER_THICK, + 0x06 => StyleBorder::BORDER_DOUBLE, + 0x07 => StyleBorder::BORDER_HAIR, + 0x08 => StyleBorder::BORDER_MEDIUMDASHED, + 0x09 => StyleBorder::BORDER_DASHDOT, + 0x0A => StyleBorder::BORDER_MEDIUMDASHDOT, + 0x0B => StyleBorder::BORDER_DASHDOTDOT, + 0x0C => StyleBorder::BORDER_MEDIUMDASHDOTDOT, + 0x0D => StyleBorder::BORDER_SLANTDASHDOT, ); /** @@ -35,6 +35,6 @@ class Border if (isset(self::$map[$index])) { return self::$map[$index]; } - return Border::BORDER_NONE; + return StyleBorder::BORDER_NONE; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php b/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php index 3b929836..c386b30b 100644 --- a/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php +++ b/src/PhpSpreadsheet/Reader/Excel5/Style/FillPattern.php @@ -42,4 +42,4 @@ class FillPattern } return Fill::FILL_NONE; } -} \ No newline at end of file +} diff --git a/src/PhpSpreadsheet/Shared/CodePage.php b/src/PhpSpreadsheet/Shared/CodePage.php index ea5f9c00..24f4b634 100644 --- a/src/PhpSpreadsheet/Shared/CodePage.php +++ b/src/PhpSpreadsheet/Shared/CodePage.php @@ -118,10 +118,10 @@ class CodePage return 'CP950'; // Macintosh Chinese Traditional case 10003: return 'CP1361'; // Macintosh Korean - case 10004: - return 'MACARABIC'; // Apple Arabic + case 10004: + return 'MACARABIC'; // Apple Arabic case 10005: - return 'MACHEBREW'; // Apple Hebrew + return 'MACHEBREW'; // Apple Hebrew case 10006: return 'MACGREEK'; // Macintosh Greek case 10007: @@ -129,11 +129,11 @@ class CodePage case 10008: return 'CP936'; // Macintosh - Simplified Chinese (GB 2312) case 10010: - return 'MACROMANIA'; // Macintosh Romania + return 'MACROMANIA'; // Macintosh Romania case 10017: - return 'MACUKRAINE'; // Macintosh Ukraine + return 'MACUKRAINE'; // Macintosh Ukraine case 10021: - return 'MACTHAI'; // Macintosh Thai + return 'MACTHAI'; // Macintosh Thai case 10029: return 'MACCENTRALEUROPE'; // Macintosh Central Europe case 10079: @@ -141,7 +141,7 @@ class CodePage case 10081: return 'MACTURKISH'; // Macintosh Turkish case 10082: - return 'MACCROATIAN'; // Macintosh Croatian + return 'MACCROATIAN'; // Macintosh Croatian case 21010: return 'UTF-16LE'; // UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE case 32768: diff --git a/src/PhpSpreadsheet/Shared/ZipArchive.php b/src/PhpSpreadsheet/Shared/ZipArchive.php index 981eeebd..7b7d9c8e 100644 --- a/src/PhpSpreadsheet/Shared/ZipArchive.php +++ b/src/PhpSpreadsheet/Shared/ZipArchive.php @@ -154,7 +154,8 @@ class ZipArchive return $contents; } - public function getFromIndex($index) { + public function getFromIndex($index) + { $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING); $contents = ''; if ((is_array($extracted)) && ($extracted != 0)) { diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index a2d27a23..eee9245e 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -238,7 +238,7 @@ class Spreadsheet { $returnData = null; $what = strtolower($what); - switch ($what){ + switch ($what) { case 'all': $returnData = $this->ribbonXMLData; break; @@ -282,7 +282,7 @@ class Spreadsheet { $ReturnData = null; $What = strtolower($What); - switch($What) { + switch ($What) { case 'all': return $this->ribbonBinObjects; break; diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index c199fffd..13a23b3e 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -447,11 +447,13 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable 'h' => 'g' ); - private static function setLowercaseCallback($matches) { + private static function setLowercaseCallback($matches) + { return mb_strtolower($matches[0]); } - private static function escapeQuotesCallback($matches) { + private static function escapeQuotesCallback($matches) + { return '\\' . implode('\\', str_split($matches[1])); } @@ -468,7 +470,7 @@ class NumberFormat extends Supervisor implements \PHPExcel\IComparable // Only process the non-quoted blocks for date format characters $blocks = explode('"', $format); - foreach($blocks as $key => &$block) { + foreach ($blocks as $key => &$block) { if ($key % 2 == 0) { $block = strtr($block, self::$dateFormatReplacements); if (!strpos($block, 'A')) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php index 7eb7bbcf..aeb2e94c 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php @@ -146,7 +146,7 @@ class ContentTypes extends WriterPart $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); } - if (!isset( $aMediaContentTypes[$extension])) { + if (!isset($aMediaContentTypes[$extension])) { $aMediaContentTypes[$extension] = $mimeType; $this->writeDefaultContentType($objWriter, $extension, $mimeType); @@ -165,7 +165,7 @@ class ContentTypes extends WriterPart for ($i = 0; $i < $sheetCount; ++$i) { if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { - if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) { + if (!isset($aMediaContentTypes[strtolower($image->getExtension())])) { $aMediaContentTypes[strtolower($image->getExtension())] = $this->getImageMimeType($image->getPath()); $this->writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php index 433f8d64..336edfd2 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php @@ -1,5 +1,7 @@ */ -class PHPExcel_Writer_OpenDocument_Cell_Comment +class Comment { public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell) { diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php index b2991673..9cb2ecda 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php @@ -1,4 +1,7 @@ */ -class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_WriterPart +class Content extends WriterPart { const NUMBER_COLS_REPEATED_MAX = 1024; const NUMBER_ROWS_REPEATED_MAX = 1048576; diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php index 51f07c97..3b344b83 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php @@ -1,5 +1,7 @@ Date: Tue, 22 Mar 2016 14:25:49 +0100 Subject: [PATCH 3/5] Fix some errors with samples --- Examples/01pharSimple.php | 6 +- Examples/01simple-download-ods.php | 6 +- Examples/01simple-download-pdf.php | 14 +-- Examples/01simple-download-xls.php | 6 +- Examples/01simple-download-xlsx.php | 6 +- Examples/01simplePCLZip.php | 8 +- Examples/02types-xls.php | 28 ++--- Examples/03formulas.php | 8 +- Examples/04printing.php | 16 +-- Examples/05featuredemo.inc.php | 76 ++++++------- Examples/05featuredemo.php | 8 +- .../06largescale-with-cellcaching-sqlite.php | 10 +- .../06largescale-with-cellcaching-sqlite3.php | 10 +- Examples/06largescale-with-cellcaching.php | 10 +- Examples/06largescale-xls.php | 6 +- Examples/06largescale.php | 6 +- Examples/07reader.php | 8 +- Examples/07readerPCLZip.php | 10 +- Examples/08conditionalformatting.php | 42 ++++---- Examples/08conditionalformatting2.php | 26 ++--- Examples/09pagebreaks.php | 10 +- Examples/10autofilter-selection-1.php | 34 +++--- Examples/10autofilter-selection-2.php | 41 ++++--- Examples/10autofilter-selection-display.php | 30 +++--- Examples/10autofilter.php | 8 +- Examples/11documentsecurity-xls.php | 6 +- Examples/11documentsecurity.php | 6 +- Examples/12cellProtection.php | 8 +- Examples/13calculation.php | 8 +- Examples/13calculationCyclicFormulae.php | 8 +- Examples/14excel5.php | 6 +- Examples/15datavalidation-xls.php | 18 ++-- Examples/15datavalidation.php | 18 ++-- Examples/16csv.php | 12 +-- Examples/17html.php | 6 +- Examples/18extendedcalculation.php | 6 +- Examples/19namedrange.php | 10 +- Examples/20readexcel5.php | 8 +- Examples/21pdf.php | 16 +-- Examples/22heavilyformatted.php | 16 +-- Examples/23sharedstyles.php | 28 ++--- Examples/24readfilter.php | 10 +- Examples/25inmemoryimage.php | 14 +-- Examples/26utf8.php | 22 ++-- Examples/27imagesexcel5.php | 8 +- Examples/28iterator.php | 7 +- Examples/29advancedvaluebinder.php | 10 +- Examples/30template.php | 10 +- Examples/31docproperties_write-xls.php | 12 +-- Examples/31docproperties_write.php | 12 +-- Examples/32chartreadwrite.php | 37 +------ Examples/33chartcreate-area.php | 36 +++---- Examples/33chartcreate-bar-stacked.php | 38 +++---- Examples/33chartcreate-bar.php | 38 +++---- Examples/33chartcreate-column-2.php | 40 +++---- Examples/33chartcreate-column.php | 38 +++---- Examples/33chartcreate-composite.php | 48 ++++----- Examples/33chartcreate-line.php | 36 +++---- Examples/33chartcreate-multiple-charts.php | 68 ++++++------ Examples/33chartcreate-pie.php | 44 ++++---- Examples/33chartcreate-radar.php | 34 +++--- Examples/33chartcreate-scatter.php | 36 +++---- Examples/33chartcreate-stock.php | 42 ++++---- Examples/34chartupdate.php | 6 +- Examples/35chartrender.php | 39 +------ Examples/36chartreadwriteHTML.php | 41 ++----- Examples/36chartreadwritePDF.php | 49 ++------- Examples/37page_layout_view.php | 10 +- Examples/38cloneWorksheet.php | 6 +- Examples/39dropdown.php | 18 ++-- Examples/40duplicateStyle.php | 10 +- Examples/41password.php | 8 +- Examples/43mergeWorkbooks.php | 10 +- Examples/44worksheetInfo.php | 9 +- Examples/Excel2003XMLReader.php | 6 +- Examples/GnumericReader.php | 6 +- Examples/OOCalcReader.php | 6 +- Examples/OOCalcReaderPCLZip.php | 8 +- Examples/Quadratic.php | 2 +- Examples/SylkReader.php | 6 +- Examples/XMLReader.php | 8 +- .../CachedObjectStorage/SQLite3.php | 2 +- src/PhpSpreadsheet/Calculation.php | 2 +- src/PhpSpreadsheet/IOFactory.php | 2 +- src/PhpSpreadsheet/NamedRange.php | 2 +- src/PhpSpreadsheet/Reader/CSV.php | 3 +- src/PhpSpreadsheet/Reader/Excel2007.php | 32 +++--- src/PhpSpreadsheet/Reader/Excel5.php | 2 +- src/PhpSpreadsheet/Reader/Excel5/Escher.php | 4 +- src/PhpSpreadsheet/Shared/Escher.php | 2 +- .../Shared/Escher/DgContainer.php | 2 +- .../Shared/Escher/DggContainer.php | 2 +- .../DggContainer/BstoreContainer/BSE.php | 2 +- .../DggContainer/BstoreContainer/BSE/Blip.php | 2 +- src/PhpSpreadsheet/Worksheet.php | 2 +- src/PhpSpreadsheet/Writer/Excel2007/Chart.php | 100 ++++++++++-------- .../Writer/Excel2007/Drawing.php | 5 +- .../Writer/Excel2007/Workbook.php | 4 +- src/PhpSpreadsheet/Writer/HTML.php | 78 +++++++------- 99 files changed, 820 insertions(+), 929 deletions(-) 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; From 73ac0aee356333c5e81175b0a849336a345c8c14 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 22 Mar 2016 15:19:00 +0100 Subject: [PATCH 4/5] Fix some errors with samples --- src/PhpSpreadsheet/Calculation/DateTime.php | 2 +- src/PhpSpreadsheet/Chart/DataSeriesValues.php | 2 +- src/PhpSpreadsheet/Chart/Layout.php | 2 +- src/PhpSpreadsheet/Chart/Legend.php | 2 +- src/PhpSpreadsheet/Reader/CSV.php | 9 +- src/PhpSpreadsheet/Reader/Excel2003XML.php | 5 +- src/PhpSpreadsheet/Reader/Excel5/Color.php | 2 +- src/PhpSpreadsheet/Shared/Date.php | 2 +- src/PhpSpreadsheet/Shared/Font.php | 2 +- .../Shared/JAMA/CholeskyDecomposition.php | 11 +- .../Shared/JAMA/EigenvalueDecomposition.php | 3 + .../Shared/JAMA/LUDecomposition.php | 23 +- src/PhpSpreadsheet/Shared/JAMA/Matrix.php | 243 +++++++++--------- .../Shared/JAMA/QRDecomposition.php | 21 +- .../JAMA/SingularValueDecomposition.php | 3 + .../Shared/JAMA/utils/Maths.php | 2 +- src/PhpSpreadsheet/Shared/String.php | 2 +- src/PhpSpreadsheet/Shared/TimeZone.php | 4 +- src/PhpSpreadsheet/Worksheet.php | 2 +- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 4 +- .../Worksheet/AutoFilter/Column.php | 4 +- .../Worksheet/AutoFilter/Column/Rule.php | 4 +- src/PhpSpreadsheet/Worksheet/BaseDrawing.php | 4 +- src/PhpSpreadsheet/Worksheet/CellIterator.php | 4 +- src/PhpSpreadsheet/Worksheet/Column.php | 4 +- .../Worksheet/ColumnCellIterator.php | 4 +- .../Worksheet/ColumnDimension.php | 4 +- .../Worksheet/ColumnIterator.php | 12 +- src/PhpSpreadsheet/Worksheet/Dimension.php | 4 +- src/PhpSpreadsheet/Worksheet/Drawing.php | 4 +- .../Worksheet/Drawing/Shadow.php | 4 +- src/PhpSpreadsheet/Worksheet/HeaderFooter.php | 4 +- .../Worksheet/HeaderFooterDrawing.php | 4 +- .../Worksheet/MemoryDrawing.php | 4 +- src/PhpSpreadsheet/Worksheet/PageMargins.php | 2 +- src/PhpSpreadsheet/Worksheet/PageSetup.php | 4 +- src/PhpSpreadsheet/Worksheet/Protection.php | 4 +- src/PhpSpreadsheet/Worksheet/Row.php | 4 +- .../Worksheet/RowCellIterator.php | 4 +- src/PhpSpreadsheet/Worksheet/RowDimension.php | 4 +- src/PhpSpreadsheet/Worksheet/RowIterator.php | 4 +- src/PhpSpreadsheet/Worksheet/SheetView.php | 4 +- src/PhpSpreadsheet/Writer/Excel2007/Chart.php | 13 +- .../Writer/Excel2007/Workbook.php | 29 +-- src/PhpSpreadsheet/Writer/HTML.php | 7 +- .../Classes/src/Calculation/DateTimeTest.php | 129 +++++----- .../src/Calculation/EngineeringTest.php | 93 ++++--- .../Classes/src/Calculation/FinancialTest.php | 69 +++-- .../Classes/src/Calculation/FunctionsTest.php | 49 ++-- .../Classes/src/Calculation/LogicalTest.php | 21 +- .../Classes/src/Calculation/LookupRefTest.php | 11 +- .../Classes/src/Calculation/MathTrigTest.php | 71 +++-- .../Classes/src/Calculation/TextDataTest.php | 61 ++--- .../src/Chart/DataSeriesValuesTest.php | 17 +- unitTests/Classes/src/Chart/LayoutTest.php | 15 +- unitTests/Classes/src/Chart/LegendTest.php | 57 ++-- .../Classes/src/Reader/XEEValidatorTest.php | 9 - unitTests/Classes/src/Shared/CodePageTest.php | 9 - unitTests/Classes/src/Shared/DateTest.php | 55 ++-- unitTests/Classes/src/Shared/FileTest.php | 9 - unitTests/Classes/src/Shared/FontTest.php | 27 +- .../Classes/src/Shared/PasswordHasherTest.php | 9 - unitTests/Classes/src/Shared/StringTest.php | 31 +-- unitTests/Classes/src/Shared/TimeZoneTest.php | 13 +- unitTests/Classes/src/Style/ColorTest.php | 9 - .../src/Style/NumberFormatDateTest.php | 9 +- .../Classes/src/Style/NumberFormatTest.php | 9 +- .../Worksheet/AutoFilter/Column/RuleTest.php | 33 +-- .../src/Worksheet/AutoFilter/ColumnTest.php | 37 ++- .../src/Worksheet/CellCollectionTest.php | 2 +- .../src/Worksheet/RowCellIteratorTest.php | 17 +- .../Classes/src/Worksheet/RowIteratorTest.php | 23 +- .../src/Worksheet/WorksheetColumnTest.php | 19 +- .../src/Worksheet/WorksheetRowTest.php | 19 +- 74 files changed, 621 insertions(+), 800 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 291a982a..2bafcc9e 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -1489,7 +1489,7 @@ class DateTime case Functions::RETURNDATE_EXCEL: return (float) \PHPExcel\Shared\Date::PHPToExcel($PHPDateObject); case Functions::RETURNDATE_PHP_NUMERIC: - return (integer) \PHPExcel\Shared\Date::ExcelToPHP(PHPExcel\Shared\Date::PHPToExcel($PHPDateObject)); + return (integer) \PHPExcel\Shared\Date::ExcelToPHP(\PHPExcel\Shared\Date::PHPToExcel($PHPDateObject)); case Functions::RETURNDATE_PHP_OBJECT: return $PHPDateObject; } diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index a318cea2..fc5e0941 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -3,7 +3,7 @@ namespace PHPExcel\Chart; /** - * PHPExcel_Chart_DataSeriesValues + * \PHPExcel\Chart\DataSeriesValues * * Copyright (c) 2006 - 2015 PHPExcel * diff --git a/src/PhpSpreadsheet/Chart/Layout.php b/src/PhpSpreadsheet/Chart/Layout.php index e0d081ce..1b78eee6 100644 --- a/src/PhpSpreadsheet/Chart/Layout.php +++ b/src/PhpSpreadsheet/Chart/Layout.php @@ -3,7 +3,7 @@ namespace PHPExcel\Chart; /** - * PHPExcel_Chart_Layout + * \PHPExcel\Chart\Layout * * Copyright (c) 2006 - 2015 PHPExcel * diff --git a/src/PhpSpreadsheet/Chart/Legend.php b/src/PhpSpreadsheet/Chart/Legend.php index f9dc6d0e..237a7a55 100644 --- a/src/PhpSpreadsheet/Chart/Legend.php +++ b/src/PhpSpreadsheet/Chart/Legend.php @@ -3,7 +3,7 @@ namespace PHPExcel\Chart; /** - * PHPExcel_Chart_Legend + * \PHPExcel\Chart\Legend * * Copyright (c) 2006 - 2015 PHPExcel * diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index 76ea6f1d..ef5a4972 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -1,6 +1,7 @@ m, $nx); } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException)); + throw new \PHPExcel\Calculation\Exception(JAMAError(MatrixSPDException)); } } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MATRIX_DIMENSION_EXCEPTION)); + throw new \PHPExcel\Calculation\Exception(JAMAError(MATRIX_DIMENSION_EXCEPTION)); } } else { - throw new PHPExcel_Calculation_Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION)); + throw new \PHPExcel\Calculation\Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION)); } } // function solve() } diff --git a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php index d4ae3979..bcecfdd4 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -1,4 +1,7 @@ LU = $A->getArray(); $this->m = $A->getRowDimension(); @@ -115,7 +118,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition } } } else { - throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(Matrix::ARGUMENT_TYPE_EXCEPTION); } } // function __construct() @@ -137,7 +140,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition } } } - return new PHPExcel_Shared_JAMA_Matrix($L); + return new Matrix($L); } // function getL() /** @@ -156,7 +159,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition } } } - return new PHPExcel_Shared_JAMA_Matrix($U); + return new Matrix($U); } // function getU() /** @@ -208,7 +211,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition } return $d; } else { - throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MATRIX_DIMENSION_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); } } // function det() @@ -217,8 +220,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition * * @param $B A Matrix with as many rows as A and any number of columns. * @return X so that L*U*X = B(piv,:) - * @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree. - * @PHPExcel_Calculation_Exception RuntimeException Matrix is singular. + * @\PHPExcel\Calculation\Exception IllegalArgumentException Matrix row dimensions must agree. + * @\PHPExcel\Calculation\Exception RuntimeException Matrix is singular. */ public function solve($B) { @@ -248,10 +251,10 @@ class PHPExcel_Shared_JAMA_LUDecomposition } return $X; } else { - throw new PHPExcel_Calculation_Exception(self::MATRIX_SINGULAR_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::MATRIX_SINGULAR_EXCEPTION); } } else { - throw new PHPExcel_Calculation_Exception(self::MATRIX_SQUARE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::MATRIX_SQUARE_EXCEPTION); } } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index 82fb0fb2..9158de25 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -1,17 +1,6 @@ = 0) { $m = $this->m - $i0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if ($j0 >= 0) { $n = $this->n - $j0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); + $R = new Matrix($m, $n); for ($i = $i0; $i < $this->m; ++$i) { for ($j = $j0; $j < $this->n; ++$j) { $R->set($i, $j, $this->A[$i][$j]); @@ -200,14 +189,14 @@ class PHPExcel_Shared_JAMA_Matrix if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1); + $R = new Matrix($m+1, $n+1); for ($i = $i0; $i <= $iF; ++$i) { for ($j = $j0; $j <= $jF; ++$j) { $R->set($i - $i0, $j - $j0, $this->A[$i][$j]); @@ -221,14 +210,14 @@ class PHPExcel_Shared_JAMA_Matrix if (count($RL) > 0) { $m = count($RL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if (count($CL) > 0) { $n = count($CL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); + $R = new Matrix($m, $n); for ($i = 0; $i < $m; ++$i) { for ($j = 0; $j < $n; ++$j) { $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]); @@ -242,14 +231,14 @@ class PHPExcel_Shared_JAMA_Matrix if (count($RL) > 0) { $m = count($RL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if (count($CL) > 0) { $n = count($CL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); + $R = new Matrix($m, $n); for ($i = 0; $i < $m; ++$i) { for ($j = 0; $j < $n; ++$j) { $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]); @@ -263,14 +252,14 @@ class PHPExcel_Shared_JAMA_Matrix if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if (count($CL) > 0) { $n = count($CL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); + $R = new Matrix($m, $n); for ($i = $i0; $i < $iF; ++$i) { for ($j = 0; $j < $n; ++$j) { $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]); @@ -284,14 +273,14 @@ class PHPExcel_Shared_JAMA_Matrix if (count($RL) > 0) { $m = count($RL); } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION); } - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1); + $R = new Matrix($m, $n+1); for ($i = 0; $i < $m; ++$i) { for ($j = $j0; $j <= $jF; ++$j) { $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]); @@ -300,11 +289,11 @@ class PHPExcel_Shared_JAMA_Matrix return $R; break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -317,14 +306,14 @@ class PHPExcel_Shared_JAMA_Matrix */ public function checkMatrixDimensions($B = null) { - if ($B instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($B instanceof Matrix) { if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { return true; } else { - throw new PHPExcel_Calculation_Exception(self::MATRIX_DIMENSION_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::MATRIX_DIMENSION_EXCEPTION); } } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } } // function checkMatrixDimensions() @@ -367,7 +356,7 @@ class PHPExcel_Shared_JAMA_Matrix */ public function diagonal($m = null, $n = null, $c = 1) { - $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); + $R = new Matrix($m, $n); for ($i = 0; $i < $m; ++$i) { $R->set($i, $i, $c); } @@ -391,7 +380,7 @@ class PHPExcel_Shared_JAMA_Matrix return $this->getMatrix($i0, 0, $i0 + 1, $this->n); } } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } } @@ -412,7 +401,7 @@ class PHPExcel_Shared_JAMA_Matrix return $this->getMatrix(0, $j0, $this->m, $j0 + 1); } } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } } @@ -424,7 +413,7 @@ class PHPExcel_Shared_JAMA_Matrix */ public function transpose() { - $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m); + $R = new Matrix($this->n, $this->m); for ($i = 0; $i < $this->m; ++$i) { for ($j = 0; $j < $this->n; ++$j) { $R->set($j, $i, $this->A[$i][$j]); @@ -474,17 +463,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -495,7 +484,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -514,17 +503,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -534,11 +523,11 @@ class PHPExcel_Shared_JAMA_Matrix $value = $M->get($i, $j); if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { $this->A[$i][$j] = trim($this->A[$i][$j], '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); } if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { $value = trim($value, '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); } if ($validValues) { $this->A[$i][$j] += $value; @@ -549,7 +538,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $this; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -568,17 +557,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -589,7 +578,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -608,17 +597,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -628,11 +617,11 @@ class PHPExcel_Shared_JAMA_Matrix $value = $M->get($i, $j); if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { $this->A[$i][$j] = trim($this->A[$i][$j], '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); } if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { $value = trim($value, '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); } if ($validValues) { $this->A[$i][$j] -= $value; @@ -643,7 +632,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $this; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -663,17 +652,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -684,7 +673,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -704,17 +693,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -724,11 +713,11 @@ class PHPExcel_Shared_JAMA_Matrix $value = $M->get($i, $j); if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { $this->A[$i][$j] = trim($this->A[$i][$j], '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); } if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { $value = trim($value, '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); } if ($validValues) { $this->A[$i][$j] *= $value; @@ -739,7 +728,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $this; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -759,17 +748,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -779,11 +768,11 @@ class PHPExcel_Shared_JAMA_Matrix $value = $M->get($i, $j); if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { $this->A[$i][$j] = trim($this->A[$i][$j], '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); } if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { $value = trim($value, '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); } if ($validValues) { if ($value == 0) { @@ -799,7 +788,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -820,17 +809,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -841,7 +830,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -862,17 +851,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -883,7 +872,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -904,17 +893,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -925,7 +914,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $M; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -945,13 +934,13 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $B = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } if ($this->n == $B->m) { - $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); + $C = new Matrix($this->m, $B->n); for ($j = 0; $j < $B->n; ++$j) { for ($k = 0; $k < $this->n; ++$k) { $Bcolj[$k] = $B->A[$k][$j]; @@ -967,13 +956,13 @@ class PHPExcel_Shared_JAMA_Matrix } return $C; } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch)); + throw new \PHPExcel\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); } break; case 'array': - $B = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $B = new Matrix($args[0]); if ($this->n == $B->m) { - $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); + $C = new Matrix($this->m, $B->n); for ($i = 0; $i < $C->m; ++$i) { for ($j = 0; $j < $C->n; ++$j) { $s = "0"; @@ -985,12 +974,12 @@ class PHPExcel_Shared_JAMA_Matrix } return $C; } else { - throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch)); + throw new \PHPExcel\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); } return $M; break; case 'integer': - $C = new PHPExcel_Shared_JAMA_Matrix($this->A); + $C = new Matrix($this->A); for ($i = 0; $i < $C->m; ++$i) { for ($j = 0; $j < $C->n; ++$j) { $C->A[$i][$j] *= $args[0]; @@ -999,7 +988,7 @@ class PHPExcel_Shared_JAMA_Matrix return $C; break; case 'double': - $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n); + $C = new Matrix($this->m, $this->n); for ($i = 0; $i < $C->m; ++$i) { for ($j = 0; $j < $C->n; ++$j) { $C->A[$i][$j] = $args[0] * $this->A[$i][$j]; @@ -1008,7 +997,7 @@ class PHPExcel_Shared_JAMA_Matrix return $C; break; case 'float': - $C = new PHPExcel_Shared_JAMA_Matrix($this->A); + $C = new Matrix($this->A); for ($i = 0; $i < $C->m; ++$i) { for ($j = 0; $j < $C->n; ++$j) { $C->A[$i][$j] *= $args[0]; @@ -1017,11 +1006,11 @@ class PHPExcel_Shared_JAMA_Matrix return $C; break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -1040,17 +1029,17 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } break; case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -1060,11 +1049,11 @@ class PHPExcel_Shared_JAMA_Matrix $value = $M->get($i, $j); if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { $this->A[$i][$j] = trim($this->A[$i][$j], '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($this->A[$i][$j]); } if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { $value = trim($value, '"'); - $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value); + $validValues &= \PHPExcel\Shared\String::convertToNumberIfFraction($value); } if ($validValues) { $this->A[$i][$j] = pow($this->A[$i][$j], $value); @@ -1075,7 +1064,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $this; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -1094,16 +1083,16 @@ class PHPExcel_Shared_JAMA_Matrix switch ($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { + if ($args[0] instanceof Matrix) { $M = $args[0]; } else { - throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION); } case 'array': - $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); + $M = new Matrix($args[0]); break; default: - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); break; } $this->checkMatrixDimensions($M); @@ -1114,7 +1103,7 @@ class PHPExcel_Shared_JAMA_Matrix } return $this; } else { - throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); } } @@ -1127,7 +1116,7 @@ class PHPExcel_Shared_JAMA_Matrix public function solve($B) { if ($this->m == $this->n) { - $LU = new PHPExcel_Shared_JAMA_LUDecomposition($this); + $LU = new LUDecomposition($this); return $LU->solve($B); } else { $QR = new PHPExcel_Shared_JAMA_QRDecomposition($this); @@ -1153,7 +1142,7 @@ class PHPExcel_Shared_JAMA_Matrix */ public function det() { - $L = new PHPExcel_Shared_JAMA_LUDecomposition($this); + $L = new LUDecomposition($this); return $L->det(); } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php index 1e43c7c4..9178ce72 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php @@ -1,4 +1,7 @@ QR = $A->getArrayCopy(); $this->m = $A->getRowDimension(); @@ -89,7 +92,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition $this->Rdiag[$k] = -$nrm; } } else { - throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ARGUMENT_TYPE_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(Matrix::ARGUMENT_TYPE_EXCEPTION); } } // function __construct() @@ -125,7 +128,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition } } } - return new PHPExcel_Shared_JAMA_Matrix($H); + return new Matrix($H); } // function getH() /** @@ -146,7 +149,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition } } } - return new PHPExcel_Shared_JAMA_Matrix($R); + return new Matrix($R); } // function getR() /** @@ -183,7 +186,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition } } */ - return new PHPExcel_Shared_JAMA_Matrix($Q); + return new Matrix($Q); } // function getQ() /** @@ -223,13 +226,13 @@ class PHPExcel_Shared_JAMA_QRDecomposition } } } - $X = new PHPExcel_Shared_JAMA_Matrix($X); + $X = new Matrix($X); return ($X->getMatrix(0, $this->n-1, 0, $nx)); } else { - throw new PHPExcel_Calculation_Exception(self::MATRIX_RANK_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(self::MATRIX_RANK_EXCEPTION); } } else { - throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MATRIX_DIMENSION_EXCEPTION); + throw new \PHPExcel\Calculation\Exception(Matrix::MATRIX_DIMENSION_EXCEPTION); } } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php index f57d122c..b25a7708 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php @@ -1,4 +1,7 @@ PHPExcel_Cell::columnIndexFromString($this->subject->getHighestColumn()) - 1) { - throw new PHPExcel_Exception("Start column ({$startColumn}) is beyond highest column ({$this->subject->getHighestColumn()})"); + if ($startColumnIndex > Cell::columnIndexFromString($this->subject->getHighestColumn()) - 1) { + throw new Exception("Start column ({$startColumn}) is beyond highest column ({$this->subject->getHighestColumn()})"); } $this->startColumn = $startColumnIndex; diff --git a/src/PhpSpreadsheet/Worksheet/Dimension.php b/src/PhpSpreadsheet/Worksheet/Dimension.php index 7b197e0c..eaec1fde 100644 --- a/src/PhpSpreadsheet/Worksheet/Dimension.php +++ b/src/PhpSpreadsheet/Worksheet/Dimension.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_Dimension + * \PHPExcel\Worksheet_Dimension * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/Drawing.php b/src/PhpSpreadsheet/Worksheet/Drawing.php index 7ad76ef7..e494702d 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_Drawing + * \PHPExcel\Worksheet_Drawing * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package \PHPExcel\Worksheet_Drawing * @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## diff --git a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php index 3431af82..9335c7a7 100644 --- a/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php +++ b/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet\Drawing; /** - * PHPExcel_Worksheet_Drawing_Shadow + * \PHPExcel\Worksheet_Drawing_Shadow * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet\Drawing; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet_Drawing + * @package \PHPExcel\Worksheet_Drawing * @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## diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php index 557d201e..688ecc0b 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooter.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooter.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_HeaderFooter + * \PHPExcel\Worksheet_HeaderFooter * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php index a2453dfb..71ecc3cd 100644 --- a/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_HeaderFooterDrawing + * \PHPExcel\Worksheet_HeaderFooterDrawing * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index d4a2d7c8..b2fab11f 100644 --- a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_MemoryDrawing + * \PHPExcel\Worksheet_MemoryDrawing * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/PageMargins.php b/src/PhpSpreadsheet/Worksheet/PageMargins.php index 3cf69def..dc4fe3fd 100644 --- a/src/PhpSpreadsheet/Worksheet/PageMargins.php +++ b/src/PhpSpreadsheet/Worksheet/PageMargins.php @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/PageSetup.php b/src/PhpSpreadsheet/Worksheet/PageSetup.php index 7aea326b..ac8297a8 100644 --- a/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## @@ -99,7 +99,7 @@ namespace PHPExcel\Worksheet; * * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PageSetup diff --git a/src/PhpSpreadsheet/Worksheet/Protection.php b/src/PhpSpreadsheet/Worksheet/Protection.php index 87d5cd91..92f78bb6 100644 --- a/src/PhpSpreadsheet/Worksheet/Protection.php +++ b/src/PhpSpreadsheet/Worksheet/Protection.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_Protection + * \PHPExcel\Worksheet_Protection * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/Row.php b/src/PhpSpreadsheet/Worksheet/Row.php index ee73d8cc..d9e3f927 100644 --- a/src/PhpSpreadsheet/Worksheet/Row.php +++ b/src/PhpSpreadsheet/Worksheet/Row.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_Row + * \PHPExcel\Worksheet\Row * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php index 223bbef8..41852348 100644 --- a/src/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_RowCellIterator + * \PHPExcel\Worksheet\RowCellIterator * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/RowDimension.php b/src/PhpSpreadsheet/Worksheet/RowDimension.php index a217784f..8bfa954c 100644 --- a/src/PhpSpreadsheet/Worksheet/RowDimension.php +++ b/src/PhpSpreadsheet/Worksheet/RowDimension.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_RowDimension + * \PHPExcel\Worksheet\RowDimension * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/RowIterator.php b/src/PhpSpreadsheet/Worksheet/RowIterator.php index 80c887f8..98ff0133 100644 --- a/src/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_RowIterator + * \PHPExcel\Worksheet\RowIterator * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Worksheet/SheetView.php b/src/PhpSpreadsheet/Worksheet/SheetView.php index d9b68c18..94cf641b 100644 --- a/src/PhpSpreadsheet/Worksheet/SheetView.php +++ b/src/PhpSpreadsheet/Worksheet/SheetView.php @@ -3,7 +3,7 @@ namespace PHPExcel\Worksheet; /** - * PHPExcel_Worksheet_SheetView + * \PHPExcel\Worksheet_SheetView * * Copyright (c) 2006 - 2015 PHPExcel * @@ -22,7 +22,7 @@ namespace PHPExcel\Worksheet; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet + * @package \PHPExcel\Worksheet * @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## diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Chart.php b/src/PhpSpreadsheet/Writer/Excel2007/Chart.php index 84fceb33..507f46b7 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Chart.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Chart.php @@ -1,5 +1,6 @@ startElement('c:cat'); } - $this->writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet); + $this->writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str'); $objWriter->endElement(); } @@ -1204,12 +1205,12 @@ class Chart extends WriterPart $objWriter->startElement('c:val'); } - $this->writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet); + $this->writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num'); $objWriter->endElement(); } if ($groupType === DataSeries::TYPE_BUBBLECHART) { - $this->writeBubbles($plotSeriesValues, $objWriter, $pSheet); + $this->writeBubbles($plotSeriesValues, $objWriter); } $objWriter->endElement(); @@ -1264,7 +1265,7 @@ class Chart extends WriterPart * * @throws \PHPExcel\Writer\Exception */ - private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', \PHPExcel\Worksheet $pSheet) + private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str') { if (is_null($plotSeriesValues)) { return; @@ -1356,7 +1357,7 @@ class Chart extends WriterPart * * @throws \PHPExcel\Writer\Exception */ - private function writeBubbles($plotSeriesValues, $objWriter, \PHPExcel\Worksheet $pSheet) + private function writeBubbles($plotSeriesValues, $objWriter) { if (is_null($plotSeriesValues)) { return; diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php index 8df8190e..a8bf24ef 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php @@ -39,7 +39,6 @@ class Workbook extends WriterPart public function writeWorkbook(\PHPExcel\SpreadSheet $pPHPExcel = null, $recalcRequired = false) { // Create XML writer - $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { @@ -90,7 +89,7 @@ class Workbook extends WriterPart * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @throws \PHPExcel\Writer\Exception */ - private function writeFileVersion(\PHPExcel\Shared\XMLWriter $objWriter = null) + private function writeFileVersion(\PHPExcel\Shared\XMLWriter $objWriter) { $objWriter->startElement('fileVersion'); $objWriter->writeAttribute('appName', 'xl'); @@ -106,7 +105,7 @@ class Workbook extends WriterPart * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @throws \PHPExcel\Writer\Exception */ - private function writeWorkbookPr(\PHPExcel\Shared\XMLWriter $objWriter = null) + private function writeWorkbookPr(\PHPExcel\Shared\XMLWriter $objWriter) { $objWriter->startElement('workbookPr'); @@ -126,7 +125,7 @@ class Workbook extends WriterPart * @param PHPExcel $pPHPExcel * @throws \PHPExcel\Writer\Exception */ - private function writeBookViews(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) + private function writeBookViews(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\SpreadSheet $pPHPExcel = null) { // bookViews $objWriter->startElement('bookViews'); @@ -156,7 +155,7 @@ class Workbook extends WriterPart * @param PHPExcel $pPHPExcel * @throws \PHPExcel\Writer\Exception */ - private function writeWorkbookProtection(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) + private function writeWorkbookProtection(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\SpreadSheet $pPHPExcel = null) { if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { $objWriter->startElement('workbookProtection'); @@ -183,7 +182,7 @@ class Workbook extends WriterPart * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing * @throws \PHPExcel\Writer\Exception */ - private function writeCalcPr(\PHPExcel\Shared\XMLWriter $objWriter = null, $recalcRequired = true) + private function writeCalcPr(\PHPExcel\Shared\XMLWriter $objWriter, $recalcRequired = true) { $objWriter->startElement('calcPr'); @@ -206,7 +205,7 @@ class Workbook extends WriterPart * @param PHPExcel $pPHPExcel * @throws \PHPExcel\Writer\Exception */ - private function writeSheets(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) + private function writeSheets(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\SpreadSheet $pPHPExcel = null) { // Write sheets $objWriter->startElement('sheets'); @@ -235,7 +234,7 @@ class Workbook extends WriterPart * @param string $sheetState Sheet state (visible, hidden, veryHidden) * @throws \PHPExcel\Writer\Exception */ - private function writeSheet(\PHPExcel\Shared\XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') + private function writeSheet(\PHPExcel\Shared\XMLWriter $objWriter, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') { if ($pSheetname != '') { // Write sheet @@ -259,7 +258,7 @@ class Workbook extends WriterPart * @param PHPExcel $pPHPExcel * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNames(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) + private function writeDefinedNames(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\SpreadSheet $pPHPExcel = null) { // Write defined names $objWriter->startElement('definedNames'); @@ -290,10 +289,10 @@ class Workbook extends WriterPart * Write named ranges * * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer - * @param PHPExcel $pPHPExcel + * @param \PHPExcel\SpreadSheet $pPHPExcel * @throws \PHPExcel\Writer\Exception */ - private function writeNamedRanges(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel) + private function writeNamedRanges(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\SpreadSheet $pPHPExcel) { // Loop named ranges $namedRanges = $pPHPExcel->getNamedRanges(); @@ -309,7 +308,7 @@ class Workbook extends WriterPart * @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, \PHPExcel\NamedRange $pNamedRange) { // definedName for named range $objWriter->startElement('definedName'); @@ -341,7 +340,7 @@ class Workbook extends WriterPart * @param int $pSheetId * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNameForAutofilter(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) + private function writeDefinedNameForAutofilter(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for autoFilter $autoFilterRange = $pSheet->getAutoFilter()->getRange(); @@ -377,7 +376,7 @@ class Workbook extends WriterPart * @param int $pSheetId * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNameForPrintTitles(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) + private function writeDefinedNameForPrintTitles(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintTitles if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { @@ -420,7 +419,7 @@ class Workbook extends WriterPart * @param int $pSheetId * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNameForPrintArea(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) + private function writeDefinedNameForPrintArea(\PHPExcel\Shared\XMLWriter $objWriter, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintArea if ($pSheet->getPageSetup()->isPrintAreaSet()) { diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php index fe328758..1859a16e 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/HTML.php @@ -1,6 +1,7 @@ assertEquals($expectedResult, $result, null, 1E-8); } @@ -34,17 +29,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testDATEtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::DATE(2012, 1, 31); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(1327968000, $result, null, 1E-8); } public function testDATEtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::DATE(2012, 1, 31); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -55,17 +50,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testDATEwith1904Calendar() { - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); - $result = PHPExcel_Calculation_DateTime::DATE(1918, 11, 11); - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + \PHPExcel\Shared\Date::setExcelCalendar(\PHPExcel\Shared\Date::CALENDAR_MAC_1904); + $result = \PHPExcel\Calculation\DateTime::DATE(1918, 11, 11); + \PHPExcel\Shared\Date::setExcelCalendar(\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900); $this->assertEquals($result, 5428); } public function testDATEwith1904CalendarError() { - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); - $result = PHPExcel_Calculation_DateTime::DATE(1901, 1, 31); - PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); + \PHPExcel\Shared\Date::setExcelCalendar(\PHPExcel\Shared\Date::CALENDAR_MAC_1904); + $result = \PHPExcel\Calculation\DateTime::DATE(1901, 1, 31); + \PHPExcel\Shared\Date::setExcelCalendar(\PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900); $this->assertEquals($result, '#NUM!'); } @@ -76,7 +71,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DATEVALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -87,17 +82,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testDATEVALUEtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::DATEVALUE('2012-1-31'); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(1327968000, $result, null, 1E-8); } public function testDATEVALUEtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::DATEVALUE('2012-1-31'); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::DATEVALUE('2012-1-31'); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -113,7 +108,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'YEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -129,7 +124,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'MONTHOFYEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -145,7 +140,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'WEEKOFYEAR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -161,7 +156,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYOFWEEK'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -177,7 +172,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYOFMONTH'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -193,7 +188,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'TIME'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -204,17 +199,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testTIMEtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::TIME(7, 30, 20); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(27020, $result, null, 1E-8); } public function testTIMEtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::TIME(7, 30, 20); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -230,7 +225,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'TIMEVALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -241,17 +236,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testTIMEVALUEtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::TIMEVALUE('7:30:20'); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(23420, $result, null, 1E-8); } public function testTIMEVALUEtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::TIMEVALUE('7:30:20'); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::TIMEVALUE('7:30:20'); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -267,7 +262,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'HOUROFDAY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -283,7 +278,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'MINUTEOFHOUR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -299,7 +294,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'SECONDOFMINUTE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -315,7 +310,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'NETWORKDAYS'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -331,7 +326,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'WORKDAY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -347,7 +342,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'EDATE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -358,17 +353,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testEDATEtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::EDATE('2012-1-26', -1); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(1324857600, $result, null, 1E-8); } public function testEDATEtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::EDATE('2012-1-26', -1); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::EDATE('2012-1-26', -1); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -384,7 +379,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'EOMONTH'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -395,17 +390,17 @@ class DateTimeTest extends PHPUnit_Framework_TestCase public function testEOMONTHtoPHP() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC); - $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_NUMERIC); + $result = \PHPExcel\Calculation\DateTime::EOMONTH('2012-1-26', -1); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); $this->assertEquals(1325289600, $result, null, 1E-8); } public function testEOMONTHtoPHPObject() { - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT); - $result = PHPExcel_Calculation_DateTime::EOMONTH('2012-1-26', -1); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_PHP_OBJECT); + $result = \PHPExcel\Calculation\DateTime::EOMONTH('2012-1-26', -1); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Must return an object... $this->assertTrue(is_object($result)); // ... of the correct type @@ -421,7 +416,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DATEDIF'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -437,7 +432,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'DAYS360'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -453,7 +448,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\DateTime', 'YEARFRAC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/src/Calculation/EngineeringTest.php b/unitTests/Classes/src/Calculation/EngineeringTest.php index 08448f55..8d2c9e97 100644 --- a/unitTests/Classes/src/Calculation/EngineeringTest.php +++ b/unitTests/Classes/src/Calculation/EngineeringTest.php @@ -12,12 +12,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } /** @@ -27,7 +22,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELI'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -43,7 +38,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELJ'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -59,7 +54,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELK'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -75,7 +70,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BESSELY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -91,7 +86,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','COMPLEX'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','COMPLEX'), $args); $this->assertEquals($expectedResult, $result); } @@ -107,7 +102,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMAGINARY'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -123,7 +118,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMREAL'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -139,7 +134,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMABS'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -155,7 +150,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMARGUMENT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -171,7 +166,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMCONJUGATE'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -188,7 +183,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMCOS'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -205,7 +200,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMDIV'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -222,7 +217,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMEXP'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -239,7 +234,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLN'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -256,7 +251,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG2'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -273,7 +268,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG10'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -290,7 +285,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPOWER'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -307,7 +302,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPRODUCT'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -324,7 +319,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSIN'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -341,7 +336,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSQRT'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -358,7 +353,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUB'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -375,7 +370,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUM'), $args); $complexAssert = new complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } @@ -392,7 +387,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','ERF'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -408,7 +403,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','ERFC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -424,7 +419,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTODEC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTODEC'), $args); $this->assertEquals($expectedResult, $result); } @@ -440,7 +435,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOHEX'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTOHEX'), $args); $this->assertEquals($expectedResult, $result); } @@ -456,7 +451,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOOCT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','BINTOOCT'), $args); $this->assertEquals($expectedResult, $result); } @@ -472,7 +467,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOBIN'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -488,7 +483,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOHEX'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -504,7 +499,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DECTOOCT'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -520,7 +515,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTOBIN'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -536,7 +531,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTODEC'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -552,7 +547,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','HEXTOOCT'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -568,7 +563,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTOBIN'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -584,7 +579,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTODEC'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -600,7 +595,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','OCTTOHEX'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -616,7 +611,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','DELTA'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -632,7 +627,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','GESTEP'), $args); $this->assertEquals($expectedResult, $result, null); } @@ -643,25 +638,25 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function testGetConversionGroups() { - $result = PHPExcel_Calculation_Engineering::getConversionGroups(); + $result = \PHPExcel\Calculation\Engineering::getConversionGroups(); $this->assertInternalType('array', $result); } public function testGetConversionGroupUnits() { - $result = PHPExcel_Calculation_Engineering::getConversionGroupUnits(); + $result = \PHPExcel\Calculation\Engineering::getConversionGroupUnits(); $this->assertInternalType('array', $result); } public function testGetConversionGroupUnitDetails() { - $result = PHPExcel_Calculation_Engineering::getConversionGroupUnitDetails(); + $result = \PHPExcel\Calculation\Engineering::getConversionGroupUnitDetails(); $this->assertInternalType('array', $result); } public function testGetConversionMultipliers() { - $result = PHPExcel_Calculation_Engineering::getConversionMultipliers(); + $result = \PHPExcel\Calculation\Engineering::getConversionMultipliers(); $this->assertInternalType('array', $result); } @@ -672,7 +667,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','CONVERTUOM'), $args); $this->assertEquals($expectedResult, $result, null); } diff --git a/unitTests/Classes/src/Calculation/FinancialTest.php b/unitTests/Classes/src/Calculation/FinancialTest.php index f6e39814..fd6a1b11 100644 --- a/unitTests/Classes/src/Calculation/FinancialTest.php +++ b/unitTests/Classes/src/Calculation/FinancialTest.php @@ -8,12 +8,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } /** @@ -23,7 +18,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ACCRINT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -39,7 +34,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ACCRINTM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ACCRINTM'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -55,7 +50,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORDEGRC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','AMORDEGRC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -71,7 +66,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','AMORLINC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','AMORLINC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -87,7 +82,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYBS'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYBS'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -103,7 +98,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYS'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYS'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -119,7 +114,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPDAYSNC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPDAYSNC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -135,7 +130,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNCD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPNCD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -151,7 +146,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPNUM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPNUM'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -167,7 +162,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','COUPPCD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','COUPPCD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -183,7 +178,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMIPMT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','CUMIPMT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -199,7 +194,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','CUMPRINC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','CUMPRINC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -215,7 +210,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DB'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DB'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -231,7 +226,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DDB'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DDB'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -247,7 +242,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DISC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DISC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -263,7 +258,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARDE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DOLLARDE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -279,7 +274,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','DOLLARFR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','DOLLARFR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -295,7 +290,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','EFFECT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -311,7 +306,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','FV'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -327,7 +322,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','FVSCHEDULE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -343,7 +338,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','INTRATE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -359,7 +354,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','IPMT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -375,7 +370,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','IRR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -391,7 +386,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','ISPMT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -407,7 +402,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','MIRR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','MIRR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -423,7 +418,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NOMINAL'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NOMINAL'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -439,7 +434,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPER'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NPER'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -455,7 +450,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','NPV'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','NPV'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -471,7 +466,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','PRICE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','PRICE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -487,7 +482,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','RATE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','RATE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -503,7 +498,7 @@ class FinancialTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Financial','XIRR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Financial','XIRR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/src/Calculation/FunctionsTest.php b/unitTests/Classes/src/Calculation/FunctionsTest.php index 61c48205..7337525a 100644 --- a/unitTests/Classes/src/Calculation/FunctionsTest.php +++ b/unitTests/Classes/src/Calculation/FunctionsTest.php @@ -8,59 +8,54 @@ class FunctionsTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } public function testDUMMY() { - $result = PHPExcel_Calculation_Functions::DUMMY(); + $result = \PHPExcel\Calculation\Functions::DUMMY(); $this->assertEquals('#Not Yet Implemented', $result); } public function testDIV0() { - $result = PHPExcel_Calculation_Functions::DIV0(); + $result = \PHPExcel\Calculation\Functions::DIV0(); $this->assertEquals('#DIV/0!', $result); } public function testNA() { - $result = PHPExcel_Calculation_Functions::NA(); + $result = \PHPExcel\Calculation\Functions::NA(); $this->assertEquals('#N/A', $result); } public function testNaN() { - $result = PHPExcel_Calculation_Functions::NaN(); + $result = \PHPExcel\Calculation\Functions::NaN(); $this->assertEquals('#NUM!', $result); } public function testNAME() { - $result = PHPExcel_Calculation_Functions::NAME(); + $result = \PHPExcel\Calculation\Functions::NAME(); $this->assertEquals('#NAME?', $result); } public function testREF() { - $result = PHPExcel_Calculation_Functions::REF(); + $result = \PHPExcel\Calculation\Functions::REF(); $this->assertEquals('#REF!', $result); } public function testNULL() { - $result = PHPExcel_Calculation_Functions::null(); + $result = \PHPExcel\Calculation\Functions::null(); $this->assertEquals('#NULL!', $result); } public function testVALUE() { - $result = PHPExcel_Calculation_Functions::VALUE(); + $result = \PHPExcel\Calculation\Functions::VALUE(); $this->assertEquals('#VALUE!', $result); } @@ -71,7 +66,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_BLANK'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_BLANK'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -87,7 +82,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_ERR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -103,7 +98,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ERROR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_ERROR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -119,7 +114,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','ERROR_TYPE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','ERROR_TYPE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -135,7 +130,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_LOGICAL'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_LOGICAL'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -151,7 +146,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NA'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_NA'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -167,7 +162,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NUMBER'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_NUMBER'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -183,7 +178,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_TEXT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_TEXT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -199,7 +194,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_NONTEXT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_NONTEXT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -215,7 +210,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_EVEN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_EVEN'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -231,7 +226,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','IS_ODD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','IS_ODD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -247,7 +242,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','TYPE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','TYPE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } @@ -263,7 +258,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Functions','N'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Functions','N'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/src/Calculation/LogicalTest.php b/unitTests/Classes/src/Calculation/LogicalTest.php index e475c30f..e370a498 100644 --- a/unitTests/Classes/src/Calculation/LogicalTest.php +++ b/unitTests/Classes/src/Calculation/LogicalTest.php @@ -8,23 +8,18 @@ class LogicalTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } public function testTRUE() { - $result = PHPExcel_Calculation_Logical::TRUE(); + $result = \PHPExcel\Calculation\Logical::TRUE(); $this->assertEquals(true, $result); } public function testFALSE() { - $result = PHPExcel_Calculation_Logical::FALSE(); + $result = \PHPExcel\Calculation\Logical::FALSE(); $this->assertEquals(false, $result); } @@ -35,7 +30,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_AND'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Logical','LOGICAL_AND'), $args); $this->assertEquals($expectedResult, $result); } @@ -51,7 +46,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Logical','LOGICAL_OR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Logical','LOGICAL_OR'), $args); $this->assertEquals($expectedResult, $result); } @@ -67,7 +62,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Logical','NOT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Logical','NOT'), $args); $this->assertEquals($expectedResult, $result); } @@ -83,7 +78,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Logical','STATEMENT_IF'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Logical','STATEMENT_IF'), $args); $this->assertEquals($expectedResult, $result); } @@ -99,7 +94,7 @@ class LogicalTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_Logical','IFERROR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\Logical','IFERROR'), $args); $this->assertEquals($expectedResult, $result); } diff --git a/unitTests/Classes/src/Calculation/LookupRefTest.php b/unitTests/Classes/src/Calculation/LookupRefTest.php index 1408b73b..f00befcc 100644 --- a/unitTests/Classes/src/Calculation/LookupRefTest.php +++ b/unitTests/Classes/src/Calculation/LookupRefTest.php @@ -8,12 +8,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } /** @@ -23,7 +18,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','HLOOKUP'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\LookupRef','HLOOKUP'), $args); $this->assertEquals($expectedResult, $result); } @@ -39,7 +34,7 @@ class LookupRefTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_LookupRef','VLOOKUP'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\LookupRef','VLOOKUP'), $args); $this->assertEquals($expectedResult, $result); } diff --git a/unitTests/Classes/src/Calculation/MathTrigTest.php b/unitTests/Classes/src/Calculation/MathTrigTest.php index 40d1c505..1cf13bce 100644 --- a/unitTests/Classes/src/Calculation/MathTrigTest.php +++ b/unitTests/Classes/src/Calculation/MathTrigTest.php @@ -8,12 +8,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } /** @@ -23,7 +18,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ATAN2'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -39,7 +34,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','CEILING'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -55,7 +50,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','COMBIN'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -71,7 +66,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','EVEN'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -87,7 +82,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ODD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -103,7 +98,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FACT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -119,7 +114,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FACTDOUBLE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -135,7 +130,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','FLOOR'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -151,7 +146,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','GCD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -167,7 +162,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','LCM'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -183,7 +178,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','INT'), $args); $this->assertEquals($expectedResult, $result); } @@ -199,7 +194,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SIGN'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -215,7 +210,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','POWER'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -231,7 +226,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','LOG_BASE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -247,7 +242,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MOD'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -263,7 +258,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MDETERM'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -279,7 +274,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MINVERSE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -295,7 +290,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MMULT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -311,7 +306,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MULTINOMIAL'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -327,9 +322,9 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'), $args); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY); + \PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_VALUE); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','MROUND'), $args); + \PHPExcel\Calculation::setArrayReturnType(\PHPExcel\Calculation::RETURN_ARRAY_AS_ARRAY); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -345,7 +340,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','PRODUCT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -361,7 +356,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','QUOTIENT'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -377,7 +372,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROUNDUP'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -393,7 +388,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROUNDDOWN'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -409,7 +404,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SERIESSUM'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -425,7 +420,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SUMSQ'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -441,7 +436,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','TRUNC'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -457,7 +452,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','ROMAN'), $args); $this->assertEquals($expectedResult, $result); } @@ -473,7 +468,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig','SQRTPI'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } @@ -489,7 +484,7 @@ class MathTrigTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\MathTrig', 'SUMIF'), $args); $this->assertEquals($expectedResult, $result, null, 1E-12); } diff --git a/unitTests/Classes/src/Calculation/TextDataTest.php b/unitTests/Classes/src/Calculation/TextDataTest.php index 135d4b09..39a408cd 100644 --- a/unitTests/Classes/src/Calculation/TextDataTest.php +++ b/unitTests/Classes/src/Calculation/TextDataTest.php @@ -8,12 +8,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); + \PHPExcel\Calculation\Functions::setCompatibilityMode(\PHPExcel\Calculation\Functions::COMPATIBILITY_EXCEL); } /** @@ -23,7 +18,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CHARACTER'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','CHARACTER'), $args); $this->assertEquals($expectedResult, $result); } @@ -39,7 +34,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','ASCIICODE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','ASCIICODE'), $args); $this->assertEquals($expectedResult, $result); } @@ -55,7 +50,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','CONCATENATE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','CONCATENATE'), $args); $this->assertEquals($expectedResult, $result); } @@ -71,7 +66,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LEFT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','LEFT'), $args); $this->assertEquals($expectedResult, $result); } @@ -87,7 +82,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','MID'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','MID'), $args); $this->assertEquals($expectedResult, $result); } @@ -103,7 +98,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RIGHT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','RIGHT'), $args); $this->assertEquals($expectedResult, $result); } @@ -119,7 +114,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','LOWERCASE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','LOWERCASE'), $args); $this->assertEquals($expectedResult, $result); } @@ -135,7 +130,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','UPPERCASE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','UPPERCASE'), $args); $this->assertEquals($expectedResult, $result); } @@ -151,7 +146,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','PROPERCASE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','PROPERCASE'), $args); $this->assertEquals($expectedResult, $result); } @@ -167,7 +162,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','STRINGLENGTH'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','STRINGLENGTH'), $args); $this->assertEquals($expectedResult, $result); } @@ -183,7 +178,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHINSENSITIVE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SEARCHINSENSITIVE'), $args); $this->assertEquals($expectedResult, $result); } @@ -199,7 +194,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SEARCHSENSITIVE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SEARCHSENSITIVE'), $args); $this->assertEquals($expectedResult, $result); } @@ -215,7 +210,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','REPLACE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','REPLACE'), $args); $this->assertEquals($expectedResult, $result); } @@ -231,7 +226,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','SUBSTITUTE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','SUBSTITUTE'), $args); $this->assertEquals($expectedResult, $result); } @@ -247,7 +242,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMSPACES'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','TRIMSPACES'), $args); $this->assertEquals($expectedResult, $result); } @@ -263,7 +258,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','TRIMNONPRINTABLE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','TRIMNONPRINTABLE'), $args); $this->assertEquals($expectedResult, $result); } @@ -279,7 +274,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','DOLLAR'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','DOLLAR'), $args); $this->assertEquals($expectedResult, $result); } @@ -295,7 +290,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','FIXEDFORMAT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','FIXEDFORMAT'), $args); $this->assertEquals($expectedResult, $result); } @@ -311,7 +306,7 @@ class TextDataTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData','RETURNSTRING'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData','RETURNSTRING'), $args); $this->assertEquals($expectedResult, $result); } @@ -326,13 +321,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase public function testTEXT() { // Enforce decimal and thousands separator values to UK/US, and currency code to USD - call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.'); - call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ','); - call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$'); + call_user_func(array('\PHPExcel\Shared\String', 'setDecimalSeparator'), '.'); + call_user_func(array('\PHPExcel\Shared\String', 'setThousandsSeparator'), ','); + call_user_func(array('\PHPExcel\Shared\String', 'setCurrencyCode'), '$'); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'TEXTFORMAT'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData', 'TEXTFORMAT'), $args); $this->assertEquals($expectedResult, $result); } @@ -346,13 +341,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase */ public function testVALUE() { - call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.'); - call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ' '); - call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$'); + call_user_func(array('\PHPExcel\Shared\String', 'setDecimalSeparator'), '.'); + call_user_func(array('\PHPExcel\Shared\String', 'setThousandsSeparator'), ' '); + call_user_func(array('\PHPExcel\Shared\String', 'setCurrencyCode'), '$'); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args); + $result = call_user_func_array(array('\PHPExcel\Calculation\TextData', 'VALUE'), $args); $this->assertEquals($expectedResult, $result, null, 1E-8); } diff --git a/unitTests/Classes/src/Chart/DataSeriesValuesTest.php b/unitTests/Classes/src/Chart/DataSeriesValuesTest.php index 5bb527cd..b796575e 100644 --- a/unitTests/Classes/src/Chart/DataSeriesValuesTest.php +++ b/unitTests/Classes/src/Chart/DataSeriesValuesTest.php @@ -3,15 +3,6 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testSetDataType() { $dataTypeValues = array( @@ -19,17 +10,17 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase 'String' ); - $testInstance = new PHPExcel_Chart_DataSeriesValues; + $testInstance = new \PHPExcel\Chart\DataSeriesValues; foreach ($dataTypeValues as $dataTypeValue) { $result = $testInstance->setDataType($dataTypeValue); - $this->assertTrue($result instanceof PHPExcel_Chart_DataSeriesValues); + $this->assertTrue($result instanceof \PHPExcel\Chart\DataSeriesValues); } } public function testSetInvalidDataTypeThrowsException() { - $testInstance = new PHPExcel_Chart_DataSeriesValues; + $testInstance = new \PHPExcel\Chart\DataSeriesValues; try { $result = $testInstance->setDataType('BOOLEAN'); @@ -44,7 +35,7 @@ class DataSeriesValuesTest extends PHPUnit_Framework_TestCase { $dataTypeValue = 'String'; - $testInstance = new PHPExcel_Chart_DataSeriesValues; + $testInstance = new \PHPExcel\Chart\DataSeriesValues; $setValue = $testInstance->setDataType($dataTypeValue); $result = $testInstance->getDataType(); diff --git a/unitTests/Classes/src/Chart/LayoutTest.php b/unitTests/Classes/src/Chart/LayoutTest.php index a06b09b4..8574dfc6 100644 --- a/unitTests/Classes/src/Chart/LayoutTest.php +++ b/unitTests/Classes/src/Chart/LayoutTest.php @@ -3,30 +3,21 @@ class LayoutTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testSetLayoutTarget() { $LayoutTargetValue = 'String'; - $testInstance = new PHPExcel_Chart_Layout; + $testInstance = new \PHPExcel\Chart\Layout; $result = $testInstance->setLayoutTarget($LayoutTargetValue); - $this->assertTrue($result instanceof PHPExcel_Chart_Layout); + $this->assertTrue($result instanceof \PHPExcel\Chart\Layout); } public function testGetLayoutTarget() { $LayoutTargetValue = 'String'; - $testInstance = new PHPExcel_Chart_Layout; + $testInstance = new \PHPExcel\Chart\Layout; $setValue = $testInstance->setLayoutTarget($LayoutTargetValue); $result = $testInstance->getLayoutTarget(); diff --git a/unitTests/Classes/src/Chart/LegendTest.php b/unitTests/Classes/src/Chart/LegendTest.php index b4df4119..e9eced4c 100644 --- a/unitTests/Classes/src/Chart/LegendTest.php +++ b/unitTests/Classes/src/Chart/LegendTest.php @@ -3,26 +3,17 @@ class LegendTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testSetPosition() { $positionValues = array( - PHPExcel_Chart_Legend::POSITION_RIGHT, - PHPExcel_Chart_Legend::POSITION_LEFT, - PHPExcel_Chart_Legend::POSITION_TOP, - PHPExcel_Chart_Legend::POSITION_BOTTOM, - PHPExcel_Chart_Legend::POSITION_TOPRIGHT, + \PHPExcel\Chart\Legend::POSITION_RIGHT, + \PHPExcel\Chart\Legend::POSITION_LEFT, + \PHPExcel\Chart\Legend::POSITION_TOP, + \PHPExcel\Chart\Legend::POSITION_BOTTOM, + \PHPExcel\Chart\Legend::POSITION_TOPRIGHT, ); - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; foreach ($positionValues as $positionValue) { $result = $testInstance->setPosition($positionValue); @@ -32,20 +23,20 @@ class LegendTest extends PHPUnit_Framework_TestCase public function testSetInvalidPositionReturnsFalse() { - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $result = $testInstance->setPosition('BottomLeft'); $this->assertFalse($result); // Ensure that value is unchanged $result = $testInstance->getPosition(); - $this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT, $result); + $this->assertEquals(\PHPExcel\Chart\Legend::POSITION_RIGHT, $result); } public function testGetPosition() { - $PositionValue = PHPExcel_Chart_Legend::POSITION_BOTTOM; + $PositionValue = \PHPExcel\Chart\Legend::POSITION_BOTTOM; - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $setValue = $testInstance->setPosition($PositionValue); $result = $testInstance->getPosition(); @@ -55,15 +46,15 @@ class LegendTest extends PHPUnit_Framework_TestCase public function testSetPositionXL() { $positionValues = array( - PHPExcel_Chart_Legend::xlLegendPositionBottom, - PHPExcel_Chart_Legend::xlLegendPositionCorner, - PHPExcel_Chart_Legend::xlLegendPositionCustom, - PHPExcel_Chart_Legend::xlLegendPositionLeft, - PHPExcel_Chart_Legend::xlLegendPositionRight, - PHPExcel_Chart_Legend::xlLegendPositionTop, + \PHPExcel\Chart\Legend::xlLegendPositionBottom, + \PHPExcel\Chart\Legend::xlLegendPositionCorner, + \PHPExcel\Chart\Legend::xlLegendPositionCustom, + \PHPExcel\Chart\Legend::xlLegendPositionLeft, + \PHPExcel\Chart\Legend::xlLegendPositionRight, + \PHPExcel\Chart\Legend::xlLegendPositionTop, ); - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; foreach ($positionValues as $positionValue) { $result = $testInstance->setPositionXL($positionValue); @@ -73,20 +64,20 @@ class LegendTest extends PHPUnit_Framework_TestCase public function testSetInvalidXLPositionReturnsFalse() { - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $result = $testInstance->setPositionXL(999); $this->assertFalse($result); // Ensure that value is unchanged $result = $testInstance->getPositionXL(); - $this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight, $result); + $this->assertEquals(\PHPExcel\Chart\Legend::xlLegendPositionRight, $result); } public function testGetPositionXL() { - $PositionValue = PHPExcel_Chart_Legend::xlLegendPositionCorner; + $PositionValue = \PHPExcel\Chart\Legend::xlLegendPositionCorner; - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $setValue = $testInstance->setPositionXL($PositionValue); $result = $testInstance->getPositionXL(); @@ -100,7 +91,7 @@ class LegendTest extends PHPUnit_Framework_TestCase false, ); - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; foreach ($overlayValues as $overlayValue) { $result = $testInstance->setOverlay($overlayValue); @@ -110,7 +101,7 @@ class LegendTest extends PHPUnit_Framework_TestCase public function testSetInvalidOverlayReturnsFalse() { - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $result = $testInstance->setOverlay('INVALID'); $this->assertFalse($result); @@ -123,7 +114,7 @@ class LegendTest extends PHPUnit_Framework_TestCase { $OverlayValue = true; - $testInstance = new PHPExcel_Chart_Legend; + $testInstance = new \PHPExcel\Chart\Legend; $setValue = $testInstance->setOverlay($OverlayValue); $result = $testInstance->getOverlay(); diff --git a/unitTests/Classes/src/Reader/XEEValidatorTest.php b/unitTests/Classes/src/Reader/XEEValidatorTest.php index 49e4aa98..a033bdfb 100644 --- a/unitTests/Classes/src/Reader/XEEValidatorTest.php +++ b/unitTests/Classes/src/Reader/XEEValidatorTest.php @@ -3,15 +3,6 @@ class XEEValidatorTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - /** * @dataProvider providerInvalidXML * @expectedException PHPExcel_Reader_Exception diff --git a/unitTests/Classes/src/Shared/CodePageTest.php b/unitTests/Classes/src/Shared/CodePageTest.php index d434694e..7d261bc3 100644 --- a/unitTests/Classes/src/Shared/CodePageTest.php +++ b/unitTests/Classes/src/Shared/CodePageTest.php @@ -5,15 +5,6 @@ require_once 'testDataFileIterator.php'; class CodePageTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - /** * @dataProvider providerCodePage */ diff --git a/unitTests/Classes/src/Shared/DateTest.php b/unitTests/Classes/src/Shared/DateTest.php index f0bf9198..c8649738 100644 --- a/unitTests/Classes/src/Shared/DateTest.php +++ b/unitTests/Classes/src/Shared/DateTest.php @@ -5,24 +5,15 @@ require_once 'testDataFileIterator.php'; class DateTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testSetExcelCalendar() { $calendarValues = array( - PHPExcel_Shared_Date::CALENDAR_MAC_1904, - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900, + \PHPExcel\Shared\Date::CALENDAR_MAC_1904, + \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900, ); foreach ($calendarValues as $calendarValue) { - $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $calendarValue); + $result = call_user_func(array('\PHPExcel\Shared\Date','setExcelCalendar'), $calendarValue); $this->assertTrue($result); } } @@ -30,7 +21,7 @@ class DateTest extends PHPUnit_Framework_TestCase public function testSetExcelCalendarWithInvalidValue() { $unsupportedCalendar = '2012'; - $result = call_user_func(array('PHPExcel_Shared_Date','setExcelCalendar'), $unsupportedCalendar); + $result = call_user_func(array('\PHPExcel\Shared\Date','setExcelCalendar'), $unsupportedCalendar); $this->assertFalse($result); } @@ -40,8 +31,8 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimeExcelToPHP1900() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900 ); $args = func_get_args(); @@ -49,7 +40,7 @@ class DateTest extends PHPUnit_Framework_TestCase if ($args[0] < 1) { $expectedResult += gmmktime(0, 0, 0); } - $result = call_user_func_array(array('PHPExcel_Shared_Date', 'ExcelToPHP'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date', 'ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); } @@ -64,13 +55,13 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimePHPToExcel1900() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900 ); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','PHPToExcel'), $args); $this->assertEquals($expectedResult, $result, null, 1E-5); } @@ -85,13 +76,13 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimeFormattedPHPToExcel1900() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900 ); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Date','FormattedPHPToExcel'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','FormattedPHPToExcel'), $args); $this->assertEquals($expectedResult, $result, null, 1E-5); } @@ -106,8 +97,8 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimeExcelToPHP1904() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_MAC_1904 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_MAC_1904 ); $args = func_get_args(); @@ -115,7 +106,7 @@ class DateTest extends PHPUnit_Framework_TestCase if ($args[0] < 1) { $expectedResult += gmmktime(0, 0, 0); } - $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); } @@ -130,13 +121,13 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimePHPToExcel1904() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_MAC_1904 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_MAC_1904 ); $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Date','PHPToExcel'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','PHPToExcel'), $args); $this->assertEquals($expectedResult, $result, null, 1E-5); } @@ -152,7 +143,7 @@ class DateTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Date','isDateTimeFormatCode'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','isDateTimeFormatCode'), $args); $this->assertEquals($expectedResult, $result); } @@ -167,8 +158,8 @@ class DateTest extends PHPUnit_Framework_TestCase public function testDateTimeExcelToPHP1900Timezone() { $result = call_user_func( - array('PHPExcel_Shared_Date','setExcelCalendar'), - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900 + array('\PHPExcel\Shared\Date','setExcelCalendar'), + \PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900 ); $args = func_get_args(); @@ -176,7 +167,7 @@ class DateTest extends PHPUnit_Framework_TestCase if ($args[0] < 1) { $expectedResult += gmmktime(0, 0, 0); } - $result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Date','ExcelToPHP'), $args); $this->assertEquals($expectedResult, $result); } diff --git a/unitTests/Classes/src/Shared/FileTest.php b/unitTests/Classes/src/Shared/FileTest.php index 6f6696c5..06ede7e8 100644 --- a/unitTests/Classes/src/Shared/FileTest.php +++ b/unitTests/Classes/src/Shared/FileTest.php @@ -5,15 +5,6 @@ require_once 'testDataFileIterator.php'; class FileTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testGetUseUploadTempDirectory() { $expectedResult = false; diff --git a/unitTests/Classes/src/Shared/FontTest.php b/unitTests/Classes/src/Shared/FontTest.php index eecd69de..1f1fe2f0 100644 --- a/unitTests/Classes/src/Shared/FontTest.php +++ b/unitTests/Classes/src/Shared/FontTest.php @@ -5,32 +5,23 @@ require_once 'testDataFileIterator.php'; class FontTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testGetAutoSizeMethod() { - $expectedResult = PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX; + $expectedResult = \PHPExcel\Shared\Font::AUTOSIZE_METHOD_APPROX; - $result = call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod')); + $result = call_user_func(array('\PHPExcel\Shared\Font','getAutoSizeMethod')); $this->assertEquals($expectedResult, $result); } public function testSetAutoSizeMethod() { $autosizeMethodValues = array( - PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT, - PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX, + \PHPExcel\Shared\Font::AUTOSIZE_METHOD_EXACT, + \PHPExcel\Shared\Font::AUTOSIZE_METHOD_APPROX, ); foreach ($autosizeMethodValues as $autosizeMethodValue) { - $result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $autosizeMethodValue); + $result = call_user_func(array('\PHPExcel\Shared\Font','setAutoSizeMethod'), $autosizeMethodValue); $this->assertTrue($result); } } @@ -39,7 +30,7 @@ class FontTest extends PHPUnit_Framework_TestCase { $unsupportedAutosizeMethod = 'guess'; - $result = call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'), $unsupportedAutosizeMethod); + $result = call_user_func(array('\PHPExcel\Shared\Font','setAutoSizeMethod'), $unsupportedAutosizeMethod); $this->assertFalse($result); } @@ -50,7 +41,7 @@ class FontTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Font','fontSizeToPixels'), $args); $this->assertEquals($expectedResult, $result); } @@ -66,7 +57,7 @@ class FontTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Font','inchSizeToPixels'), $args); $this->assertEquals($expectedResult, $result); } @@ -82,7 +73,7 @@ class FontTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'), $args); + $result = call_user_func_array(array('\PHPExcel\Shared\Font','centimeterSizeToPixels'), $args); $this->assertEquals($expectedResult, $result); } diff --git a/unitTests/Classes/src/Shared/PasswordHasherTest.php b/unitTests/Classes/src/Shared/PasswordHasherTest.php index 620acb98..a86a1ee5 100644 --- a/unitTests/Classes/src/Shared/PasswordHasherTest.php +++ b/unitTests/Classes/src/Shared/PasswordHasherTest.php @@ -5,15 +5,6 @@ require_once 'testDataFileIterator.php'; class PasswordHasherTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - /** * @dataProvider providerHashPassword */ diff --git a/unitTests/Classes/src/Shared/StringTest.php b/unitTests/Classes/src/Shared/StringTest.php index 9955d816..5df90ea8 100644 --- a/unitTests/Classes/src/Shared/StringTest.php +++ b/unitTests/Classes/src/Shared/StringTest.php @@ -5,24 +5,15 @@ require_once 'testDataFileIterator.php'; class StringTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testGetIsMbStringEnabled() { - $result = call_user_func(array('PHPExcel_Shared_String','getIsMbstringEnabled')); + $result = call_user_func(array('\PHPExcel\Shared\String','getIsMbstringEnabled')); $this->assertTrue($result); } public function testGetIsIconvEnabled() { - $result = call_user_func(array('PHPExcel_Shared_String','getIsIconvEnabled')); + $result = call_user_func(array('\PHPExcel\Shared\String','getIsIconvEnabled')); $this->assertTrue($result); } @@ -31,16 +22,16 @@ class StringTest extends PHPUnit_Framework_TestCase $localeconv = localeconv(); $expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ','; - $result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator')); + $result = call_user_func(array('\PHPExcel\Shared\String','getDecimalSeparator')); $this->assertEquals($expectedResult, $result); } public function testSetDecimalSeparator() { $expectedResult = ','; - $result = call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'), $expectedResult); + $result = call_user_func(array('\PHPExcel\Shared\String','setDecimalSeparator'), $expectedResult); - $result = call_user_func(array('PHPExcel_Shared_String','getDecimalSeparator')); + $result = call_user_func(array('\PHPExcel\Shared\String','getDecimalSeparator')); $this->assertEquals($expectedResult, $result); } @@ -49,16 +40,16 @@ class StringTest extends PHPUnit_Framework_TestCase $localeconv = localeconv(); $expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ','; - $result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator')); + $result = call_user_func(array('\PHPExcel\Shared\String','getThousandsSeparator')); $this->assertEquals($expectedResult, $result); } public function testSetThousandsSeparator() { $expectedResult = ' '; - $result = call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'), $expectedResult); + $result = call_user_func(array('\PHPExcel\Shared\String','setThousandsSeparator'), $expectedResult); - $result = call_user_func(array('PHPExcel_Shared_String','getThousandsSeparator')); + $result = call_user_func(array('\PHPExcel\Shared\String','getThousandsSeparator')); $this->assertEquals($expectedResult, $result); } @@ -67,16 +58,16 @@ class StringTest extends PHPUnit_Framework_TestCase $localeconv = localeconv(); $expectedResult = (!empty($localeconv['currency_symbol'])) ? $localeconv['currency_symbol'] : '$'; - $result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode')); + $result = call_user_func(array('\PHPExcel\Shared\String','getCurrencyCode')); $this->assertEquals($expectedResult, $result); } public function testSetCurrencyCode() { $expectedResult = '£'; - $result = call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'), $expectedResult); + $result = call_user_func(array('\PHPExcel\Shared\String','setCurrencyCode'), $expectedResult); - $result = call_user_func(array('PHPExcel_Shared_String','getCurrencyCode')); + $result = call_user_func(array('\PHPExcel\Shared\String','getCurrencyCode')); $this->assertEquals($expectedResult, $result); } } diff --git a/unitTests/Classes/src/Shared/TimeZoneTest.php b/unitTests/Classes/src/Shared/TimeZoneTest.php index 25484267..40edf950 100644 --- a/unitTests/Classes/src/Shared/TimeZoneTest.php +++ b/unitTests/Classes/src/Shared/TimeZoneTest.php @@ -3,15 +3,6 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - } - public function testSetTimezone() { $timezoneValues = array( @@ -23,7 +14,7 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase ); foreach ($timezoneValues as $timezoneValue) { - $result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'), $timezoneValue); + $result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $timezoneValue); $this->assertTrue($result); } @@ -32,7 +23,7 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase public function testSetTimezoneWithInvalidValue() { $unsupportedTimezone = 'Etc/GMT+10'; - $result = call_user_func(array('PHPExcel_Shared_TimeZone','setTimezone'), $unsupportedTimezone); + $result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $unsupportedTimezone); $this->assertFalse($result); } } diff --git a/unitTests/Classes/src/Style/ColorTest.php b/unitTests/Classes/src/Style/ColorTest.php index 83427b10..c590260e 100644 --- a/unitTests/Classes/src/Style/ColorTest.php +++ b/unitTests/Classes/src/Style/ColorTest.php @@ -5,15 +5,6 @@ require_once 'testDataFileIteratorJson.php'; class ColorTest extends PHPUnit_Framework_TestCase { - - public function setUp() - { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . '/Bootstrap.php'); - } - /** * @dataProvider providerColorGetRed */ diff --git a/unitTests/Classes/src/Style/NumberFormatDateTest.php b/unitTests/Classes/src/Style/NumberFormatDateTest.php index 8ba828f7..da36aee6 100644 --- a/unitTests/Classes/src/Style/NumberFormatDateTest.php +++ b/unitTests/Classes/src/Style/NumberFormatDateTest.php @@ -8,13 +8,8 @@ class NumberFormatDateTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Shared_String::setDecimalSeparator('.'); - PHPExcel_Shared_String::setThousandsSeparator(','); + \PHPExcel\Shared\String::setDecimalSeparator('.'); + \PHPExcel\Shared\String::setThousandsSeparator(','); } /** diff --git a/unitTests/Classes/src/Style/NumberFormatTest.php b/unitTests/Classes/src/Style/NumberFormatTest.php index 08c2f024..170ff868 100644 --- a/unitTests/Classes/src/Style/NumberFormatTest.php +++ b/unitTests/Classes/src/Style/NumberFormatTest.php @@ -8,13 +8,8 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - PHPExcel_Shared_String::setDecimalSeparator('.'); - PHPExcel_Shared_String::setThousandsSeparator(','); + \PHPExcel\Shared\String::setDecimalSeparator('.'); + \PHPExcel\Shared\String::setThousandsSeparator(','); } /** diff --git a/unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php b/unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php index 0c39c683..ffeaa85e 100644 --- a/unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php +++ b/unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php @@ -9,12 +9,7 @@ class RuleTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - $this->_mockAutoFilterColumnObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter_Column') + $this->_mockAutoFilterColumnObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter\Column') ->disableOriginalConstructor() ->getMock(); @@ -22,7 +17,7 @@ class RuleTest extends PHPUnit_Framework_TestCase ->method('testColumnInRange') ->will($this->returnValue(3)); - $this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule( + $this->_testAutoFilterRuleObject = new \PHPExcel\Worksheet\AutoFilter\Column\Rule( $this->_mockAutoFilterColumnObject ); } @@ -30,16 +25,16 @@ class RuleTest extends PHPUnit_Framework_TestCase public function testGetRuleType() { $result = $this->_testAutoFilterRuleObject->getRuleType(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_FILTER, $result); } public function testSetRuleType() { - $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP; + $expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP; // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); $result = $this->_testAutoFilterRuleObject->getRuleType(); $this->assertEquals($expectedResult, $result); @@ -51,7 +46,7 @@ class RuleTest extends PHPUnit_Framework_TestCase // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterRuleObject->setValue($expectedResult); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); $result = $this->_testAutoFilterRuleObject->getValue(); $this->assertEquals($expectedResult, $result); @@ -60,16 +55,16 @@ class RuleTest extends PHPUnit_Framework_TestCase public function testGetOperator() { $result = $this->_testAutoFilterRuleObject->getOperator(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result); } public function testSetOperator() { - $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; + $expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterRuleObject->setOperator($expectedResult); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); $result = $this->_testAutoFilterRuleObject->getOperator(); $this->assertEquals($expectedResult, $result); @@ -77,11 +72,11 @@ class RuleTest extends PHPUnit_Framework_TestCase public function testSetGrouping() { - $expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH; + $expectedResult = \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH; // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); $result = $this->_testAutoFilterRuleObject->getGrouping(); $this->assertEquals($expectedResult, $result); @@ -90,19 +85,19 @@ class RuleTest extends PHPUnit_Framework_TestCase public function testGetParent() { $result = $this->_testAutoFilterRuleObject->getParent(); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); } public function testSetParent() { // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); } public function testClone() { $result = clone $this->_testAutoFilterRuleObject; - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column\Rule', $result); } } diff --git a/unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php b/unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php index da6eef53..0a8b4461 100644 --- a/unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php +++ b/unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php @@ -11,12 +11,7 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - $this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter') + $this->_mockAutoFilterObject = $this->getMockBuilder('\PHPExcel\Worksheet\AutoFilter') ->disableOriginalConstructor() ->getMock(); @@ -24,7 +19,7 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase ->method('testColumnInRange') ->will($this->returnValue(3)); - $this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column( + $this->_testAutoFilterColumnObject = new \PHPExcel\Worksheet\AutoFilter\Column( $this->_testInitialColumn, $this->_mockAutoFilterObject ); @@ -42,7 +37,7 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); $result = $this->_testAutoFilterColumnObject->getColumnIndex(); $this->assertEquals($expectedResult, $result); @@ -51,29 +46,29 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase public function testGetParent() { $result = $this->_testAutoFilterColumnObject->getParent(); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter', $result); } public function testSetParent() { // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); } public function testGetFilterType() { $result = $this->_testAutoFilterColumnObject->getFilterType(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER, $result); } public function testSetFilterType() { - $result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $result = $this->_testAutoFilterColumnObject->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); $result = $this->_testAutoFilterColumnObject->getFilterType(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result); } /** @@ -89,16 +84,16 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase public function testGetJoin() { $result = $this->_testAutoFilterColumnObject->getJoin(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR, $result); } public function testSetJoin() { - $result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $result = $this->_testAutoFilterColumnObject->setJoin(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); $result = $this->_testAutoFilterColumnObject->getJoin(); - $this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result); + $this->assertEquals(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND, $result); } /** @@ -119,7 +114,7 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); } public function testGetAttributes() @@ -144,7 +139,7 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase foreach ($attributeSet as $attributeName => $attributeValue) { // Setters return the instance to implement the fluent interface $result = $this->_testAutoFilterColumnObject->setAttribute($attributeName, $attributeValue); - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); } } @@ -167,6 +162,6 @@ class AutofilterColumnTest extends PHPUnit_Framework_TestCase public function testClone() { $result = clone $this->_testAutoFilterColumnObject; - $this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result); + $this->assertInstanceOf('\PHPExcel\Worksheet\AutoFilter\Column', $result); } } diff --git a/unitTests/Classes/src/Worksheet/CellCollectionTest.php b/unitTests/Classes/src/Worksheet/CellCollectionTest.php index 4e489c28..1b71933b 100644 --- a/unitTests/Classes/src/Worksheet/CellCollectionTest.php +++ b/unitTests/Classes/src/Worksheet/CellCollectionTest.php @@ -14,7 +14,7 @@ class CellCollectionTest extends \PHPUnit_Framework_TestCase $methods = \PHPExcel\CachedObjectStorageFactory::getCacheStorageMethods(); foreach ($methods as $method) { \PHPExcel\CachedObjectStorageFactory::initialize($method); - $workbook = new \PHPExcel(); + $workbook = new \PHPExcel\Spreadsheet(); $cells = ['A1', 'A2']; $worksheet = $workbook->getActiveSheet(); $worksheet->setCellValue('A1', 1); diff --git a/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php b/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php index ec60e90b..3eeb0ac2 100644 --- a/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php +++ b/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php @@ -7,16 +7,11 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - $this->mockCell = $this->getMockBuilder('PHPExcel_Cell') ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') + $this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet') ->disableOriginalConstructor() ->getMock(); @@ -31,7 +26,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorFullRange() { - $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet); + $iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet); $RowCellIndexResult = 'A'; $this->assertEquals($RowCellIndexResult, $iterator->key()); @@ -43,7 +38,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorStartEndRange() { - $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); + $iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $RowCellIndexResult = 'B'; $this->assertEquals($RowCellIndexResult, $iterator->key()); @@ -56,7 +51,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorSeekAndPrev() { $ranges = range('A', 'E'); - $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); + $iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $RowCellIndexResult = 'D'; $iterator->seek('D'); $this->assertEquals($RowCellIndexResult, $iterator->key()); @@ -73,7 +68,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase */ public function testSeekOutOfRange() { - $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); + $iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator->seek(1); } @@ -82,7 +77,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase */ public function testPrevOutOfRange() { - $iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); + $iterator = new \PHPExcel\Worksheet\RowCellIterator($this->mockWorksheet, 2, 'B', 'D'); $iterator->prev(); } } diff --git a/unitTests/Classes/src/Worksheet/RowIteratorTest.php b/unitTests/Classes/src/Worksheet/RowIteratorTest.php index ec0b2796..c02b0632 100644 --- a/unitTests/Classes/src/Worksheet/RowIteratorTest.php +++ b/unitTests/Classes/src/Worksheet/RowIteratorTest.php @@ -7,16 +7,11 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - $this->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row') + $this->mockRow = $this->getMockBuilder('\PHPExcel\Worksheet\Row') ->disableOriginalConstructor() ->getMock(); - $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') + $this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet') ->disableOriginalConstructor() ->getMock(); @@ -31,31 +26,31 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase public function testIteratorFullRange() { - $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet); + $iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet); $rowIndexResult = 1; $this->assertEquals($rowIndexResult, $iterator->key()); foreach ($iterator as $key => $row) { $this->assertEquals($rowIndexResult++, $key); - $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); + $this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row); } } public function testIteratorStartEndRange() { - $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); + $iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4); $rowIndexResult = 2; $this->assertEquals($rowIndexResult, $iterator->key()); foreach ($iterator as $key => $row) { $this->assertEquals($rowIndexResult++, $key); - $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); + $this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row); } } public function testIteratorSeekAndPrev() { - $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); + $iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4); $columnIndexResult = 4; $iterator->seek(4); $this->assertEquals($columnIndexResult, $iterator->key()); @@ -71,7 +66,7 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase */ public function testSeekOutOfRange() { - $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); + $iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4); $iterator->seek(1); } @@ -80,7 +75,7 @@ class RowIteratorTest extends PHPUnit_Framework_TestCase */ public function testPrevOutOfRange() { - $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); + $iterator = new \PHPExcel\Worksheet\RowIterator($this->mockWorksheet, 2, 4); $iterator->prev(); } } diff --git a/unitTests/Classes/src/Worksheet/WorksheetColumnTest.php b/unitTests/Classes/src/Worksheet/WorksheetColumnTest.php index 9e880fb9..78d9cecf 100644 --- a/unitTests/Classes/src/Worksheet/WorksheetColumnTest.php +++ b/unitTests/Classes/src/Worksheet/WorksheetColumnTest.php @@ -7,12 +7,7 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') + $this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet') ->disableOriginalConstructor() ->getMock(); $this->mockWorksheet->expects($this->any()) @@ -23,24 +18,24 @@ class WorksheetColumnTest extends PHPUnit_Framework_TestCase public function testInstantiateColumnDefault() { - $column = new PHPExcel_Worksheet_Column($this->mockWorksheet); - $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); + $column = new \PHPExcel\Worksheet\Column($this->mockWorksheet); + $this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column); $columnIndex = $column->getColumnIndex(); $this->assertEquals('A', $columnIndex); } public function testInstantiateColumnSpecified() { - $column = new PHPExcel_Worksheet_Column($this->mockWorksheet, 'E'); - $this->assertInstanceOf('PHPExcel_Worksheet_Column', $column); + $column = new \PHPExcel\Worksheet\Column($this->mockWorksheet, 'E'); + $this->assertInstanceOf('\PHPExcel\Worksheet\Column', $column); $columnIndex = $column->getColumnIndex(); $this->assertEquals('E', $columnIndex); } public function testGetCellIterator() { - $column = new PHPExcel_Worksheet_Column($this->mockWorksheet); + $column = new \PHPExcel\Worksheet\Column($this->mockWorksheet); $cellIterator = $column->getCellIterator(); - $this->assertInstanceOf('PHPExcel_Worksheet_ColumnCellIterator', $cellIterator); + $this->assertInstanceOf('\PHPExcel\Worksheet\ColumnCellIterator', $cellIterator); } } diff --git a/unitTests/Classes/src/Worksheet/WorksheetRowTest.php b/unitTests/Classes/src/Worksheet/WorksheetRowTest.php index 059d8b20..0617a6c7 100644 --- a/unitTests/Classes/src/Worksheet/WorksheetRowTest.php +++ b/unitTests/Classes/src/Worksheet/WorksheetRowTest.php @@ -7,12 +7,7 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase public function setUp() { - if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); - } - require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); - - $this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet') + $this->mockWorksheet = $this->getMockBuilder('\PHPExcel\Worksheet') ->disableOriginalConstructor() ->getMock(); $this->mockWorksheet->expects($this->any()) @@ -23,24 +18,24 @@ class WorksheetRowTest extends PHPUnit_Framework_TestCase public function testInstantiateRowDefault() { - $row = new PHPExcel_Worksheet_Row($this->mockWorksheet); - $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); + $row = new \PHPExcel\Worksheet\Row($this->mockWorksheet); + $this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row); $rowIndex = $row->getRowIndex(); $this->assertEquals(1, $rowIndex); } public function testInstantiateRowSpecified() { - $row = new PHPExcel_Worksheet_Row($this->mockWorksheet, 5); - $this->assertInstanceOf('PHPExcel_Worksheet_Row', $row); + $row = new \PHPExcel\Worksheet\Row($this->mockWorksheet, 5); + $this->assertInstanceOf('\PHPExcel\Worksheet\Row', $row); $rowIndex = $row->getRowIndex(); $this->assertEquals(5, $rowIndex); } public function testGetCellIterator() { - $row = new PHPExcel_Worksheet_Row($this->mockWorksheet); + $row = new \PHPExcel\Worksheet\Row($this->mockWorksheet); $cellIterator = $row->getCellIterator(); - $this->assertInstanceOf('PHPExcel_Worksheet_RowCellIterator', $cellIterator); + $this->assertInstanceOf('\PHPExcel\Worksheet\RowCellIterator', $cellIterator); } } From 95e6c5e26469c21f419d00974e6088934e592254 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 22 Mar 2016 15:35:50 +0100 Subject: [PATCH 5/5] #401 : Support for namespaces --- .../Worksheet/ColumnIterator.php | 1 + .../Classes/src/Calculation/DateTimeTest.php | 43 ++++--- .../src/Calculation/EngineeringTest.php | 108 +++++++++--------- .../Classes/src/Calculation/FinancialTest.php | 65 +++++------ .../Classes/src/Calculation/FunctionsTest.php | 29 ++--- .../Classes/src/Calculation/LogicalTest.php | 13 ++- .../Classes/src/Calculation/LookupRefTest.php | 7 +- .../Classes/src/Calculation/MathTrigTest.php | 61 +++++----- .../Classes/src/Calculation/TextDataTest.php | 45 ++++---- .../src/Cell/AdvancedValueBinderTest.php | 4 +- unitTests/Classes/src/Cell/DataTypeTest.php | 3 +- .../src/Cell/DefaultValueBinderTest.php | 6 +- unitTests/Classes/src/Cell/HyperlinkTest.php | 3 +- .../src/Chart/DataSeriesValuesTest.php | 3 +- unitTests/Classes/src/Chart/LayoutTest.php | 3 +- unitTests/Classes/src/Chart/LegendTest.php | 3 +- .../Classes/src/Reader/XEEValidatorTest.php | 3 +- unitTests/Classes/src/Shared/CodePageTest.php | 5 +- unitTests/Classes/src/Shared/DateTest.php | 17 +-- unitTests/Classes/src/Shared/FileTest.php | 3 +- unitTests/Classes/src/Shared/FontTest.php | 9 +- .../Classes/src/Shared/PasswordHasherTest.php | 5 +- unitTests/Classes/src/Shared/StringTest.php | 3 +- unitTests/Classes/src/Shared/TimeZoneTest.php | 3 +- unitTests/Classes/src/Style/ColorTest.php | 12 +- .../src/Style/NumberFormatDateTest.php | 5 +- .../Classes/src/Style/NumberFormatTest.php | 5 +- .../Worksheet/AutoFilter/Column/RuleTest.php | 3 +- .../src/Worksheet/AutoFilter/ColumnTest.php | 3 +- .../src/Worksheet/RowCellIteratorTest.php | 4 +- .../Classes/src/Worksheet/RowIteratorTest.php | 4 +- .../src/Worksheet/WorksheetColumnTest.php | 4 +- .../src/Worksheet/WorksheetRowTest.php | 4 +- unitTests/bootstrap.php | 2 + 34 files changed, 266 insertions(+), 225 deletions(-) diff --git a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php index a6e49fd5..e1e41f60 100644 --- a/src/PhpSpreadsheet/Worksheet/ColumnIterator.php +++ b/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -1,6 +1,7 @@ assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMCONJUGATE() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMCONJUGATE.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMCONJUGATE.data'); } /** @@ -184,13 +186,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMCOS'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMCOS() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMCOS.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMCOS.data'); } /** @@ -201,13 +203,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMDIV'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMDIV() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMDIV.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMDIV.data'); } /** @@ -218,13 +220,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMEXP'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMEXP() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMEXP.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMEXP.data'); } /** @@ -235,13 +237,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLN'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMLN() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLN.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMLN.data'); } /** @@ -252,13 +254,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG2'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMLOG2() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG2.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG2.data'); } /** @@ -269,13 +271,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMLOG10'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMLOG10() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG10.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG10.data'); } /** @@ -286,13 +288,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPOWER'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMPOWER() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMPOWER.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMPOWER.data'); } /** @@ -303,13 +305,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMPRODUCT'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMPRODUCT() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMPRODUCT.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMPRODUCT.data'); } /** @@ -320,13 +322,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSIN'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMSIN() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSIN.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMSIN.data'); } /** @@ -337,13 +339,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSQRT'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMSQRT() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSQRT.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMSQRT.data'); } /** @@ -354,13 +356,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUB'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMSUB() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSUB.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMSUB.data'); } /** @@ -371,13 +373,13 @@ class EngineeringTest extends PHPUnit_Framework_TestCase $args = func_get_args(); $expectedResult = array_pop($args); $result = call_user_func_array(array('\PHPExcel\Calculation\Engineering','IMSUM'), $args); - $complexAssert = new complexAssert(); + $complexAssert = new \complexAssert(); $this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8), $complexAssert->getErrorMessage()); } public function providerIMSUM() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSUM.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/IMSUM.data'); } /** @@ -393,7 +395,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerERF() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/ERF.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/ERF.data'); } /** @@ -409,7 +411,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerERFC() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/ERFC.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/ERFC.data'); } /** @@ -425,7 +427,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerBIN2DEC() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2DEC.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/BIN2DEC.data'); } /** @@ -441,7 +443,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerBIN2HEX() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2HEX.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/BIN2HEX.data'); } /** @@ -457,7 +459,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerBIN2OCT() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2OCT.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/BIN2OCT.data'); } /** @@ -473,7 +475,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerDEC2BIN() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2BIN.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/DEC2BIN.data'); } /** @@ -489,7 +491,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerDEC2HEX() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2HEX.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/DEC2HEX.data'); } /** @@ -505,7 +507,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerDEC2OCT() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2OCT.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/DEC2OCT.data'); } /** @@ -521,7 +523,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerHEX2BIN() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2BIN.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/HEX2BIN.data'); } /** @@ -537,7 +539,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerHEX2DEC() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2DEC.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/HEX2DEC.data'); } /** @@ -553,7 +555,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerHEX2OCT() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2OCT.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/HEX2OCT.data'); } /** @@ -569,7 +571,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerOCT2BIN() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2BIN.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/OCT2BIN.data'); } /** @@ -585,7 +587,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerOCT2DEC() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2DEC.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/OCT2DEC.data'); } /** @@ -601,7 +603,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerOCT2HEX() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2HEX.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/OCT2HEX.data'); } /** @@ -617,7 +619,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerDELTA() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/DELTA.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/DELTA.data'); } /** @@ -633,7 +635,7 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerGESTEP() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/GESTEP.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/GESTEP.data'); } public function testGetConversionGroups() @@ -673,6 +675,6 @@ class EngineeringTest extends PHPUnit_Framework_TestCase public function providerCONVERTUOM() { - return new testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data'); + return new \testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data'); } } diff --git a/unitTests/Classes/src/Calculation/FinancialTest.php b/unitTests/Classes/src/Calculation/FinancialTest.php index fd6a1b11..4e6b02d7 100644 --- a/unitTests/Classes/src/Calculation/FinancialTest.php +++ b/unitTests/Classes/src/Calculation/FinancialTest.php @@ -1,9 +1,10 @@