From daf2482dd61e2be61421e68cd0445ebf91382723 Mon Sep 17 00:00:00 2001 From: Frans Saris Date: Wed, 1 Jul 2015 13:26:15 +0200 Subject: [PATCH] [TASK] Namespaced /Writer/ Classes --- src/PhpSpreadsheet/Writer/Excel2007.php | 71 ++-- src/PhpSpreadsheet/Writer/Excel2007/Chart.php | 81 ++--- .../Writer/Excel2007/Comments.php | 47 +-- .../Writer/Excel2007/ContentTypes.php | 41 +-- .../Writer/Excel2007/DocProps.php | 39 +-- .../Writer/Excel2007/Drawing.php | 93 ++--- src/PhpSpreadsheet/Writer/Excel2007/Rels.php | 75 +++-- .../Writer/Excel2007/RelsRibbon.php | 15 +- .../Writer/Excel2007/RelsVBA.php | 15 +- .../Writer/Excel2007/StringTable.php | 58 ++-- src/PhpSpreadsheet/Writer/Excel2007/Style.php | 185 +++++----- src/PhpSpreadsheet/Writer/Excel2007/Theme.php | 29 +- .../Writer/Excel2007/Workbook.php | 123 +++---- .../Writer/Excel2007/Worksheet.php | 301 ++++++++--------- .../Writer/Excel2007/WriterPart.php | 4 +- src/PhpSpreadsheet/Writer/Excel5.php | 30 +- .../Writer/Excel5/BIFFwriter.php | 2 +- src/PhpSpreadsheet/Writer/Excel5/Font.php | 16 +- src/PhpSpreadsheet/Writer/Excel5/Parser.php | 42 +-- src/PhpSpreadsheet/Writer/Excel5/Workbook.php | 12 +- .../Writer/Excel5/Worksheet.php | 318 +++++++++--------- src/PhpSpreadsheet/Writer/Excel5/Xf.php | 116 +++---- src/PhpSpreadsheet/Writer/Exception.php | 2 +- src/PhpSpreadsheet/Writer/HTML.php | 166 ++++----- src/PhpSpreadsheet/Writer/IWriter.php | 2 +- src/PhpSpreadsheet/Writer/OpenDocument.php | 28 +- .../Writer/OpenDocument/Content.php | 30 +- .../Writer/OpenDocument/Meta.php | 6 +- .../Writer/OpenDocument/MetaInf.php | 6 +- .../Writer/OpenDocument/Mimetype.php | 6 +- .../Writer/OpenDocument/Settings.php | 4 +- .../Writer/OpenDocument/Styles.php | 4 +- .../Writer/OpenDocument/Thumbnails.php | 4 +- .../Writer/OpenDocument/WriterPart.php | 2 +- src/PhpSpreadsheet/Writer/PDF/Core.php | 146 ++++---- src/PhpSpreadsheet/Writer/PDF/DomPDF.php | 10 +- src/PhpSpreadsheet/Writer/PDF/mPDF.php | 10 +- src/PhpSpreadsheet/Writer/PDF/tcPDF.php | 8 +- 38 files changed, 1082 insertions(+), 1065 deletions(-) diff --git a/src/PhpSpreadsheet/Writer/Excel2007.php b/src/PhpSpreadsheet/Writer/Excel2007.php index f1469e04..80b7edc2 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007.php +++ b/src/PhpSpreadsheet/Writer/Excel2007.php @@ -27,7 +27,7 @@ namespace PHPExcel\Writer; * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -class Excel2007 extends BaseWriter implements IWriter +class Excel2007 implements IWriter { /** * Pre-calculate formulas @@ -76,9 +76,9 @@ class Excel2007 extends BaseWriter implements IWriter private $stylesConditionalHashTable; /** - * Private unique PHPExcel_Style HashTable + * Private unique \PHPExcel\Style HashTable * - * @var PHPExcel_HashTable + * @var \PHPExcel\HashTable */ private $styleHashTable; @@ -120,7 +120,7 @@ class Excel2007 extends BaseWriter implements IWriter /** * Create a new PHPExcel_Writer_Excel2007 * - * @param PHPExcel $pPHPExcel + * @param \PHPExcel\SpreadSheet $pPHPExcel */ public function __construct(\PHPExcel\Spreadsheet $pPHPExcel = null) { @@ -156,7 +156,7 @@ class Excel2007 extends BaseWriter implements IWriter // Set HashTable variables foreach ($hashTablesArray as $tableName) { - $this->$tableName = new PHPExcel_HashTable(); + $this->$tableName = new \PHPExcel\HashTable(); } } @@ -164,7 +164,7 @@ class Excel2007 extends BaseWriter implements IWriter * Get writer part * * @param string $pPartName Writer part name - * @return PHPExcel_Writer_Excel2007_WriterPart + * @return \PHPExcel\Writer\Excel2007\WriterPart */ public function getWriterPart($pPartName = '') { @@ -179,7 +179,7 @@ class Excel2007 extends BaseWriter implements IWriter * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { @@ -198,8 +198,8 @@ class Excel2007 extends BaseWriter implements IWriter $saveDebugLog = PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->getWriteDebugLog(); PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog(false); - $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveDateReturnType = \PHPExcel\Calculation\Functions::getReturnDateType(); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // Create string lookup table $this->stringTable = array(); @@ -219,12 +219,13 @@ class Excel2007 extends BaseWriter implements IWriter $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->spreadSheet)); // Create new ZIP file and open it for writing - $zipClass = PHPExcel_Settings::getZipClass(); + $zipClass = \PHPExcel\Settings::getZipClass(); + /** @var \ZipArchive $objZip */ $objZip = new $zipClass(); // Retrieve OVERWRITE and CREATE constants from the instantiated zip class // This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP - $ro = new ReflectionObject($objZip); + $ro = new \ReflectionObject($objZip); $zipOverWrite = $ro->getConstant('OVERWRITE'); $zipCreate = $ro->getConstant('CREATE'); @@ -234,7 +235,7 @@ class Excel2007 extends BaseWriter implements IWriter // Try opening the ZIP file if ($objZip->open($pFilename, $zipOverWrite) !== true) { if ($objZip->open($pFilename, $zipCreate) !== true) { - throw new PHPExcel_Writer_Exception("Could not open " . $pFilename . " for writing."); + throw new \PHPExcel\Writer\Exception("Could not open " . $pFilename . " for writing."); } } @@ -267,7 +268,7 @@ class Excel2007 extends BaseWriter implements IWriter $objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet)); } } - + // Add relationships to ZIP file $objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->spreadSheet)); $objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->spreadSheet)); @@ -354,7 +355,7 @@ class Excel2007 extends BaseWriter implements IWriter // Add media for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { - if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + if ($this->getDrawingHashTable()->getByIndex($i) instanceof \PHPExcel\Worksheet\Drawing) { $imageContents = null; $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath(); if (strpos($imagePath, 'zip://') !== false) { @@ -371,7 +372,7 @@ class Excel2007 extends BaseWriter implements IWriter } $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); - } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof \PHPExcel\Worksheet\MemoryDrawing) { ob_start(); call_user_func( $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), @@ -384,23 +385,23 @@ class Excel2007 extends BaseWriter implements IWriter } } - PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); + \PHPExcel\Calculation\Functions::setReturnDateType($saveDateReturnType); PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); // Close file if ($objZip->close() === false) { - throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename."); + throw new \PHPExcel\Writer\Exception("Could not close zip file $pFilename."); } // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new \PHPExcel\Writer\Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } } else { - throw new PHPExcel_Writer_Exception("PHPExcel object unassigned."); + throw new \PHPExcel\Writer\Exception("PHPExcel object unassigned."); } } @@ -408,14 +409,14 @@ class Excel2007 extends BaseWriter implements IWriter * Get PHPExcel object * * @return PHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function getPHPExcel() { if ($this->spreadSheet !== null) { return $this->spreadSheet; } else { - throw new PHPExcel_Writer_Exception("No PHPExcel object assigned."); + throw new \PHPExcel\Writer\Exception("No PHPExcel object assigned."); } } @@ -443,9 +444,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style HashTable + * Get \PHPExcel\Style HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getStyleHashTable() { @@ -453,9 +454,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style_Conditional HashTable + * Get \PHPExcel\Style\Conditional HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getStylesConditionalHashTable() { @@ -463,9 +464,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style_Fill HashTable + * Get \PHPExcel\Style\Fill HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getFillHashTable() { @@ -473,9 +474,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style_Font HashTable + * Get \PHPExcel\Style\Font HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getFontHashTable() { @@ -483,9 +484,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style_Borders HashTable + * Get \PHPExcel\Style\Borders HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getBordersHashTable() { @@ -493,9 +494,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Style_NumberFormat HashTable + * Get \PHPExcel\Style\NumberFormat HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getNumFmtHashTable() { @@ -503,9 +504,9 @@ class Excel2007 extends BaseWriter implements IWriter } /** - * Get PHPExcel_Worksheet_BaseDrawing HashTable + * Get \PHPExcel\Worksheet\BaseDrawing HashTable * - * @return PHPExcel_HashTable + * @return \PHPExcel\HashTable */ public function getDrawingHashTable() { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Chart.php b/src/PhpSpreadsheet/Writer/Excel2007/Chart.php index ebe0018f..d4afb4fc 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Chart.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Chart.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // Ensure that data series values are up-to-date before we save $pChart->refresh(); @@ -106,9 +107,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Chart Title * * @param PHPExcel_Chart_Title $title - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) { @@ -151,9 +152,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Chart Legend * * @param PHPExcel_Chart_Legend $legend - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) { @@ -206,11 +207,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Chart_Title $yAxisLabel * @param PHPExcel_Chart_Axis $xAxis * @param PHPExcel_Chart_Axis $yAxis - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines) + private function writePlotArea(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) { if (is_null($plotArea)) { return; @@ -341,10 +342,10 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Data Labels * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel_Chart_Layout $chartLayout Chart layout * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeDataLabels($objWriter, $chartLayout) { @@ -391,7 +392,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Category Axis * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel_Chart_PlotArea $plotArea * @param PHPExcel_Chart_Title $xAxisLabel * @param string $groupType Chart type @@ -399,7 +400,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param string $id2 * @param boolean $isMultiLevelSeries * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeCategoryAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) { @@ -445,7 +446,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } $objWriter->startElement('a:t'); // $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($caption)); + $objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($caption)); $objWriter->endElement(); $objWriter->endElement(); @@ -513,7 +514,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Value Axis * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel_Chart_PlotArea $plotArea * @param PHPExcel_Chart_Title $yAxisLabel * @param string $groupType Chart type @@ -521,7 +522,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param string $id2 * @param boolean $isMultiLevelSeries * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeValueAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) { @@ -794,7 +795,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('a:t'); // $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($caption)); + $objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($caption)); $objWriter->endElement(); $objWriter->endElement(); @@ -1002,7 +1003,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Chart_PlotArea $plotArea * * @return string|array - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private static function getChartType($plotArea) { @@ -1017,7 +1018,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } $chartType = array_unique($chartTypes); if (count($chartTypes) == 0) { - throw new PHPExcel_Writer_Exception('Chart is not yet implemented'); + throw new \PHPExcel\Writer\Exception('Chart is not yet implemented'); } } @@ -1029,15 +1030,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_DataSeries $plotGroup * @param string $groupType Type of plot for dataseries - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param boolean &$catIsMultiLevelSeries Is category a multi-series category * @param boolean &$valIsMultiLevelSeries Is value set a multi-series set * @param string &$plotGroupingType Type of grouping for multi-series values - * @param PHPExcel_Worksheet $pSheet + * @param \PHPExcel\Worksheet $pSheet * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet) + private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, \PHPExcel\Worksheet $pSheet) { if (is_null($plotGroup)) { return; @@ -1207,9 +1208,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Plot Series Label * * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writePlotSeriesLabel($plotSeriesLabel, $objWriter) { @@ -1242,14 +1243,14 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Plot Series Values * * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $groupType Type of plot for dataseries * @param string $dataType Datatype of series values - * @param PHPExcel_Worksheet $pSheet + * @param \PHPExcel\Worksheet $pSheet * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) + private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', \PHPExcel\Worksheet $pSheet) { if (is_null($plotSeriesValues)) { return; @@ -1337,11 +1338,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Bubble Chart Details * * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) + private function writeBubbles($plotSeriesValues, $objWriter, \PHPExcel\Worksheet $pSheet) { if (is_null($plotSeriesValues)) { return; @@ -1384,9 +1385,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Layout * * @param PHPExcel_Chart_Layout $layout - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) { @@ -1453,9 +1454,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Alternate Content block * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writeAlternateContent($objWriter) { @@ -1483,9 +1484,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Printer Settings * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function writePrintSettings($objWriter) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Comments.php b/src/PhpSpreadsheet/Writer/Excel2007/Comments.php index 7139f6c4..b226d160 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Comments.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Comments.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -86,13 +87,13 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference - * @param PHPExcel_Comment $pComment Comment + * @param \PHPExcel\Comment $pComment Comment * @param array $pAuthors Array of authors - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) + private function writeComment(\PHPExcel\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PHPExcel\Comment $pComment = null, $pAuthors = null) { // comment $objWriter->startElement('comment'); @@ -110,18 +111,18 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write VML comments to XML format * - * @param PHPExcel_Worksheet $pWorksheet - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Worksheet $pWorksheet + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) + public function writeVMLComments(\PHPExcel\Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -182,16 +183,16 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write /** * Write VML comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference - * @param PHPExcel_Comment $pComment Comment - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Comment $pComment Comment + * @throws \PHPExcel\Writer\Exception */ - private function writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) + private function writeVMLComment(\PHPExcel\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PHPExcel\Comment $pComment = null) { // Metadata - list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference); - $column = PHPExcel_Cell::columnIndexFromString($column); + list($column, $row) = \PHPExcel\Cell::coordinateFromString($pCellReference); + $column = \PHPExcel\Cell::columnIndexFromString($column); $id = 1024 + $column + $row; $id = substr($id, 0, 4); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php index 0d911899..7eb7bbcf 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/ContentTypes.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -134,10 +135,10 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $extension = ''; $mimeType = ''; - if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { + if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof \PHPExcel\Worksheet\Drawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $mimeType = $this->getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath()); - } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { + } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof \PHPExcel\Worksheet\MemoryDrawing) { $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = explode('/', $extension); $extension = $extension[1]; @@ -184,27 +185,27 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * * @param string $pFile Filename * @return string Mime Type - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function getImageMimeType($pFile = '') { - if (PHPExcel_Shared_File::file_exists($pFile)) { + if (\PHPExcel\Shared\File::file_exists($pFile)) { $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { - throw new PHPExcel_Writer_Exception("File $pFile does not exist"); + throw new \PHPExcel\Writer\Exception("File $pFile does not exist"); } } /** * Write Default content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + private function writeDefaultContentType(\PHPExcel\Shared\XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { if ($pPartname != '' && $pContentType != '') { // Write content type @@ -213,19 +214,19 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } /** * Write Override content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') + private function writeOverrideContentType(\PHPExcel\Shared\XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { if ($pPartname != '' && $pContentType != '') { // Write content type @@ -234,7 +235,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/DocProps.php b/src/PhpSpreadsheet/Writer/Excel2007/DocProps.php index fef3d937..8558abb6 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/DocProps.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/DocProps.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -127,18 +128,18 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write /** * Write docProps/core.xml to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeDocPropsCore(PHPExcel $pPHPExcel = null) + public function writeDocPropsCore(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -194,11 +195,11 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write /** * Write docProps/custom.xml to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeDocPropsCustom(PHPExcel $pPHPExcel = null) + public function writeDocPropsCustom(\PHPExcel\SpreadSheet $pPHPExcel = null) { $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); if (empty($customPropertyList)) { @@ -208,9 +209,9 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php b/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php index 28143888..7e3c3126 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Drawing.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -83,31 +84,31 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write drawings to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel_Chart $pChart * @param int $pRelationId - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeChart(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1) + public function writeChart(\PHPExcel\Shared\XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1) { $tl = $pChart->getTopLeftPosition(); - $tl['colRow'] = PHPExcel_Cell::coordinateFromString($tl['cell']); + $tl['colRow'] = \PHPExcel\Cell::coordinateFromString($tl['cell']); $br = $pChart->getBottomRightPosition(); - $br['colRow'] = PHPExcel_Cell::coordinateFromString($br['cell']); + $br['colRow'] = \PHPExcel\Cell::coordinateFromString($br['cell']); $objWriter->startElement('xdr:twoCellAnchor'); $objWriter->startElement('xdr:from'); - $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($tl['colRow'][0]) - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['xOffset'])); + $objWriter->writeElement('xdr:col', \PHPExcel\Cell::columnIndexFromString($tl['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', \PHPExcel\Shared\Drawing::pixelsToEMU($tl['xOffset'])); $objWriter->writeElement('xdr:row', $tl['colRow'][1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['yOffset'])); + $objWriter->writeElement('xdr:rowOff', \PHPExcel\Shared\Drawing::pixelsToEMU($tl['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:to'); - $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($br['colRow'][0]) - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['xOffset'])); + $objWriter->writeElement('xdr:col', \PHPExcel\Cell::columnIndexFromString($br['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', \PHPExcel\Shared\Drawing::pixelsToEMU($br['xOffset'])); $objWriter->writeElement('xdr:row', $br['colRow'][1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['yOffset'])); + $objWriter->writeElement('xdr:rowOff', \PHPExcel\Shared\Drawing::pixelsToEMU($br['yOffset'])); $objWriter->endElement(); $objWriter->startElement('xdr:graphicFrame'); @@ -155,32 +156,32 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write drawings to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet_BaseDrawing $pDrawing + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet\BaseDrawing $pDrawing * @param int $pRelationId - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1) + public function writeDrawing(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet\BaseDrawing $pDrawing = null, $pRelationId = -1) { if ($pRelationId >= 0) { // xdr:oneCellAnchor $objWriter->startElement('xdr:oneCellAnchor'); // Image location - $aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates()); - $aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]); + $aCoordinates = \PHPExcel\Cell::coordinateFromString($pDrawing->getCoordinates()); + $aCoordinates[0] = \PHPExcel\Cell::columnIndexFromString($aCoordinates[0]); // xdr:from $objWriter->startElement('xdr:from'); $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1); - $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX())); + $objWriter->writeElement('xdr:colOff', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getOffsetX())); $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1); - $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY())); + $objWriter->writeElement('xdr:rowOff', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getOffsetY())); $objWriter->endElement(); // xdr:ext $objWriter->startElement('xdr:ext'); - $objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth())); - $objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight())); + $objWriter->writeAttribute('cx', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getWidth())); + $objWriter->writeAttribute('cy', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getHeight())); $objWriter->endElement(); // xdr:pic @@ -229,7 +230,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer // a:xfrm $objWriter->startElement('a:xfrm'); - $objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation())); + $objWriter->writeAttribute('rot', \PHPExcel\Shared\Drawing::degreesToAngle($pDrawing->getRotation())); $objWriter->endElement(); // a:prstGeom @@ -288,9 +289,9 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer // a:outerShdw $objWriter->startElement('a:outerShdw'); - $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); - $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); - $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); + $objWriter->writeAttribute('blurRad', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', \PHPExcel\Shared\Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', \PHPExcel\Shared\Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment()); $objWriter->writeAttribute('rotWithShape', '0'); @@ -366,25 +367,25 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } /** * Write VML header/footer images to XML format * - * @param PHPExcel_Worksheet $pWorksheet - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Worksheet $pWorksheet + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null) + public function writeVMLHeaderFooterImages(\PHPExcel\Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -520,12 +521,12 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer /** * Write VML comment to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pReference Reference - * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Worksheet\HeaderFooterDrawing $pImage Image + * @throws \PHPExcel\Writer\Exception */ - private function writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null) + private function writeVMLHeaderFooterImage(\PHPExcel\Shared\XMLWriter $objWriter = null, $pReference = '', \PHPExcel\Worksheet\HeaderFooterDrawing $pImage = null) { // Calculate object id preg_match('{(\d+)}', md5($pReference), $m); @@ -564,10 +565,10 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * Get an array of all drawings * * @param PHPExcel $pPHPExcel - * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel - * @throws PHPExcel_Writer_Exception + * @return \PHPExcel\Worksheet\Drawing[] All drawings in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allDrawings(PHPExcel $pPHPExcel = null) + public function allDrawings(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of all drawings $aDrawings = array(); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Rels.php b/src/PhpSpreadsheet/Writer/Excel2007/Rels.php index dd1faf9b..ed8298d5 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Rels.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Rels.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -104,18 +105,18 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write workbook relationships to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null) + public function writeWorkbookRelationships(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -183,20 +184,20 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * rId1 - Drawings * rId_hyperlink_x - Hyperlinks * - * @param PHPExcel_Worksheet $pWorksheet + * @param \PHPExcel\Worksheet $pWorksheet * @param int $pWorksheetId * @param boolean $includeCharts Flag indicating if we should write charts - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false) + public function writeWorksheetRelationships(\PHPExcel\Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -291,20 +292,20 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write drawing relationships to XML format * - * @param PHPExcel_Worksheet $pWorksheet + * @param \PHPExcel\Worksheet $pWorksheet * @param int &$chartRef Chart ID * @param boolean $includeCharts Flag indicating if we should write charts - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false) + public function writeDrawingRelationships(\PHPExcel\Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -318,8 +319,8 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar $i = 1; $iterator = $pWorksheet->getDrawingCollection()->getIterator(); while ($iterator->valid()) { - if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing - || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) { + if ($iterator->current() instanceof \PHPExcel\Worksheet\Drawing + || $iterator->current() instanceof \PHPExcel\Worksheet\MemoryDrawing) { // Write relationship for image drawing $this->writeRelationship( $objWriter, @@ -356,18 +357,18 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write header/footer drawing relationships to XML format * - * @param PHPExcel_Worksheet $pWorksheet - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Worksheet $pWorksheet + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) + public function writeHeaderFooterDrawingRelationships(\PHPExcel\Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -396,14 +397,14 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar /** * Write Override content type * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param int $pId Relationship ID. rId will be prepended! * @param string $pType Relationship type * @param string $pTarget Relationship target * @param string $pTargetMode Relationship target mode - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') + private function writeRelationship(\PHPExcel\Shared\XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') { if ($pType != '' && $pTarget != '') { // Write relationship @@ -418,7 +419,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/RelsRibbon.php b/src/PhpSpreadsheet/Writer/Excel2007/RelsRibbon.php index 5a4a9fc0..1c6102e7 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/RelsRibbon.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/RelsRibbon.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header diff --git a/src/PhpSpreadsheet/Writer/Excel2007/RelsVBA.php b/src/PhpSpreadsheet/Writer/Excel2007/RelsVBA.php index bee0e643..b4854a6c 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/RelsVBA.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/RelsVBA.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header diff --git a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php index d1ce0ae5..76baaf37 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/StringTable.php @@ -35,7 +35,7 @@ class StringTable extends WriterPart * @param \PHPExcel\Worksheet $pSheet Worksheet * @param string[] $pExistingTable Existing table to eventually merge with * @return string[] String table for worksheet - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function createStringTable($pSheet = null, $pExistingTable = null) { @@ -61,10 +61,10 @@ class StringTable extends WriterPart ($cellValue !== null) && $cellValue !== '' && !isset($aFlippedStringTable[$cellValue]) && - ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) { + ($cell->getDataType() == \PHPExcel\Cell\DataType::TYPE_STRING || $cell->getDataType() == \PHPExcel\Cell\DataType::TYPE_STRING2 || $cell->getDataType() == \PHPExcel\Cell\DataType::TYPE_NULL)) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue] = true; - } elseif ($cellValue instanceof PHPExcel_RichText && + } elseif ($cellValue instanceof \PHPExcel\RichText && ($cellValue !== null) && !isset($aFlippedStringTable[$cellValue->getHashCode()])) { $aStringTable[] = $cellValue; @@ -74,7 +74,7 @@ class StringTable extends WriterPart return $aStringTable; } else { - throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); + throw new \PHPExcel\Writer\Exception("Invalid \PHPExcel\Worksheet object passed."); } } @@ -82,8 +82,8 @@ class StringTable extends WriterPart * Write string table to XML format * * @param string[] $pStringTable - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ public function writeStringTable($pStringTable = null) { @@ -91,9 +91,9 @@ class StringTable extends WriterPart // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -108,15 +108,15 @@ class StringTable extends WriterPart foreach ($pStringTable as $textElement) { $objWriter->startElement('si'); - if (! $textElement instanceof PHPExcel_RichText) { - $textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement); + if (! $textElement instanceof \PHPExcel\RichText) { + $textToWrite = \PHPExcel\Shared\String::ControlCharacterPHP2OOXML($textElement); $objWriter->startElement('t'); if ($textToWrite !== trim($textToWrite)) { $objWriter->writeAttribute('xml:space', 'preserve'); } $objWriter->writeRawData($textToWrite); $objWriter->endElement(); - } elseif ($textElement instanceof PHPExcel_RichText) { + } elseif ($textElement instanceof \PHPExcel\RichText) { $this->writeRichText($objWriter, $textElement); } @@ -127,24 +127,24 @@ class StringTable extends WriterPart return $objWriter->getData(); } else { - throw new PHPExcel_Writer_Exception("Invalid string table array passed."); + throw new \PHPExcel\Writer\Exception("Invalid string table array passed."); } } /** * Write Rich Text * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_RichText $pRichText Rich text + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\RichText $pRichText Rich text * @param string $prefix Optional Namespace prefix - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix = null) + public function writeRichText(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\RichText $pRichText = null, $prefix = null) { if ($prefix !== null) { $prefix .= ':'; } - + // Loop through rich text elements $elements = $pRichText->getRichTextElements(); foreach ($elements as $element) { @@ -152,7 +152,7 @@ class StringTable extends WriterPart $objWriter->startElement($prefix.'r'); // rPr - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof \PHPExcel\RichText\Run) { // rPr $objWriter->startElement($prefix.'rPr'); @@ -208,7 +208,7 @@ class StringTable extends WriterPart // t $objWriter->startElement($prefix.'t'); $objWriter->writeAttribute('xml:space', 'preserve'); - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText())); + $objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($element->getText())); $objWriter->endElement(); $objWriter->endElement(); @@ -218,23 +218,23 @@ class StringTable extends WriterPart /** * Write Rich Text * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param string|PHPExcel_RichText $pRichText text string or Rich text + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param string|\PHPExcel\RichText $pRichText text string or Rich text * @param string $prefix Optional Namespace prefix - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix = null) + public function writeRichTextForCharts(\PHPExcel\Shared\XMLWriter $objWriter = null, $pRichText = null, $prefix = null) { - if (!$pRichText instanceof PHPExcel_RichText) { + if (!$pRichText instanceof \PHPExcel\RichText) { $textRun = $pRichText; - $pRichText = new PHPExcel_RichText(); + $pRichText = new \PHPExcel\RichText(); $pRichText->createTextRun($textRun); } if ($prefix !== null) { $prefix .= ':'; } - + // Loop through rich text elements $elements = $pRichText->getRichTextElements(); foreach ($elements as $element) { @@ -283,7 +283,7 @@ class StringTable extends WriterPart // t $objWriter->startElement($prefix.'t'); // $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains - $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText())); + $objWriter->writeRawData(\PHPExcel\Shared\String::ControlCharacterPHP2OOXML($element->getText())); $objWriter->endElement(); $objWriter->endElement(); @@ -303,9 +303,9 @@ class StringTable extends WriterPart // Loop through stringtable and add flipped items to $returnValue foreach ($stringTable as $key => $value) { - if (! $value instanceof PHPExcel_RichText) { + if (! $value instanceof \PHPExcel\RichText) { $returnValue[$value] = $key; - } elseif ($value instanceof PHPExcel_RichText) { + } elseif ($value instanceof \PHPExcel\RichText) { $returnValue[$value->getHashCode()] = $key; } } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Style.php b/src/PhpSpreadsheet/Writer/Excel2007/Style.php index d3f0af7b..7f0b4e44 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Style.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Style.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -160,15 +161,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\Fill $pFill Fill style + * @throws \PHPExcel\Writer\Exception */ - private function writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function writeFill(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Fill $pFill = null) { // Check if this is a pattern type or gradient type - if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR || - $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) { + if ($pFill->getFillType() === \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR || + $pFill->getFillType() === \PHPExcel\Style\Fill::FILL_GRADIENT_PATH) { // Gradient fill $this->writeGradientFill($objWriter, $pFill); } elseif ($pFill->getFillType() !== null) { @@ -180,11 +181,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Gradient Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\Fill $pFill Fill style + * @throws \PHPExcel\Writer\Exception */ - private function writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function writeGradientFill(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Fill $pFill = null) { // fill $objWriter->startElement('fill'); @@ -224,11 +225,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Pattern Fill * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Fill $pFill Fill style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\Fill $pFill Fill style + * @throws \PHPExcel\Writer\Exception */ - private function writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) + private function writePatternFill(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Fill $pFill = null) { // fill $objWriter->startElement('fill'); @@ -237,7 +238,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('patternFill'); $objWriter->writeAttribute('patternType', $pFill->getFillType()); - if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { + if ($pFill->getFillType() !== \PHPExcel\Style\Fill::FILL_NONE) { // fgColor if ($pFill->getStartColor()->getARGB()) { $objWriter->startElement('fgColor'); @@ -245,7 +246,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); } } - if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { + if ($pFill->getFillType() !== \PHPExcel\Style\Fill::FILL_NONE) { // bgColor if ($pFill->getEndColor()->getARGB()) { $objWriter->startElement('bgColor'); @@ -262,11 +263,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Font * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Font $pFont Font style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\Font $pFont Font style + * @throws \PHPExcel\Writer\Exception */ - private function writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) + private function writeFont(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Font $pFont = null) { // font $objWriter->startElement('font'); @@ -342,25 +343,25 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Border * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_Borders $pBorders Borders style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\Borders $pBorders Borders style + * @throws \PHPExcel\Writer\Exception */ - private function writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) + private function writeBorder(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Borders $pBorders = null) { // Write border $objWriter->startElement('border'); // Diagonal? switch ($pBorders->getDiagonalDirection()) { - case PHPExcel_Style_Borders::DIAGONAL_UP: + case \PHPExcel\Style\Borders::DIAGONAL_UP: $objWriter->writeAttribute('diagonalUp', 'true'); $objWriter->writeAttribute('diagonalDown', 'false'); break; - case PHPExcel_Style_Borders::DIAGONAL_DOWN: + case \PHPExcel\Style\Borders::DIAGONAL_DOWN: $objWriter->writeAttribute('diagonalUp', 'false'); $objWriter->writeAttribute('diagonalDown', 'true'); break; - case PHPExcel_Style_Borders::DIAGONAL_BOTH: + case \PHPExcel\Style\Borders::DIAGONAL_BOTH: $objWriter->writeAttribute('diagonalUp', 'true'); $objWriter->writeAttribute('diagonalDown', 'true'); break; @@ -378,12 +379,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Cell Style Xf * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style $pStyle Style - * @param PHPExcel $pPHPExcel Workbook - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style $pStyle Style + * @param \PHPExcel\SpreadSheet $pPHPExcel Workbook + * @throws \PHPExcel\Writer\Exception */ - private function writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) + private function writeCellStyleXf(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style $pStyle = null, \PHPExcel\SpreadSheet $pPHPExcel = null) { // xf $objWriter->startElement('xf'); @@ -408,7 +409,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0'); $objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0'); $objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0'); - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() != \PHPExcel\Style\Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != \PHPExcel\Style\Protection::PROTECTION_INHERIT) { $objWriter->writeAttribute('applyProtection', 'true'); } @@ -437,13 +438,13 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); // protection - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() != \PHPExcel\Style\Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != \PHPExcel\Style\Protection::PROTECTION_INHERIT) { $objWriter->startElement('protection'); - if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { - $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + if ($pStyle->getProtection()->getLocked() != \PHPExcel\Style\Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } - if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { - $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + if ($pStyle->getProtection()->getHidden() != \PHPExcel\Style\Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } $objWriter->endElement(); } @@ -454,11 +455,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write Cell Style Dxf * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style $pStyle Style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style $pStyle Style + * @throws \PHPExcel\Writer\Exception */ - private function writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) + private function writeCellStyleDxf(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style $pStyle = null) { // dxf $objWriter->startElement('dxf'); @@ -497,16 +498,16 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa // protection if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) { - if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT || - $pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) { + if ($pStyle->getProtection()->getLocked() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT || + $pStyle->getProtection()->getHidden() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT) { $objWriter->startElement('protection'); if (($pStyle->getProtection()->getLocked() !== null) && - ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { - $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + ($pStyle->getProtection()->getLocked() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } if (($pStyle->getProtection()->getHidden() !== null) && - ($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { - $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + ($pStyle->getProtection()->getHidden() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false')); } $objWriter->endElement(); } @@ -518,15 +519,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write BorderPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pName Element name - * @param PHPExcel_Style_Border $pBorder Border style - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Style\Border $pBorder Border style + * @throws \PHPExcel\Writer\Exception */ - private function writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) + private function writeBorderPr(\PHPExcel\Shared\XMLWriter $objWriter = null, $pName = 'left', \PHPExcel\Style\Border $pBorder = null) { // Write BorderPr - if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { + if ($pBorder->getBorderStyle() != \PHPExcel\Style\Border::BORDER_NONE) { $objWriter->startElement($pName); $objWriter->writeAttribute('style', $pBorder->getBorderStyle()); @@ -542,12 +543,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Write NumberFormat * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Style\NumberFormat $pNumberFormat Number Format * @param int $pId Number Format identifier - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) + private function writeNumFmt(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\NumberFormat $pNumberFormat = null, $pId = 0) { // Translate formatcode $formatCode = $pNumberFormat->getFormatCode(); @@ -566,9 +567,9 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style[] All styles in PHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function allStyles(PHPExcel $pPHPExcel = null) + public function allStyles(\PHPExcel\SpreadSheet $pPHPExcel = null) { return $pPHPExcel->getCellXfCollection(); } @@ -576,11 +577,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Get an array of all conditional styles * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return \PHPExcel\Style\Conditional[] All conditional styles in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allConditionalStyles(PHPExcel $pPHPExcel = null) + public function allConditionalStyles(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of all styles $aStyles = array(); @@ -600,25 +601,26 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Get an array of all fills * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Fill[] All fills in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return \PHPExcel\Style\Fill[] All fills in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allFills(PHPExcel $pPHPExcel = null) + public function allFills(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of unique fills $aFills = array(); // Two first fills are predefined - $fill0 = new PHPExcel_Style_Fill(); - $fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE); + $fill0 = new \PHPExcel\Style\Fill(); + $fill0->setFillType(\PHPExcel\Style\Fill::FILL_NONE); $aFills[] = $fill0; - $fill1 = new PHPExcel_Style_Fill(); - $fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125); + $fill1 = new \PHPExcel\Style\Fill(); + $fill1->setFillType(\PHPExcel\Style\Fill::FILL_PATTERN_GRAY125); $aFills[] = $fill1; // The remaining fills $aStyles = $this->allStyles($pPHPExcel); + /** @var \PHPExcel\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) { $aFills[ $style->getFill()->getHashCode() ] = $style->getFill(); @@ -631,16 +633,17 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Get an array of all fonts * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Font[] All fonts in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return \PHPExcel\Style\Font[] All fonts in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allFonts(PHPExcel $pPHPExcel = null) + public function allFonts(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of unique fonts $aFonts = array(); $aStyles = $this->allStyles($pPHPExcel); + /** @var \PHPExcel\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) { $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont(); @@ -653,16 +656,17 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Get an array of all borders * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_Borders[] All borders in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return \PHPExcel\Style\Borders[] All borders in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allBorders(PHPExcel $pPHPExcel = null) + public function allBorders(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of unique borders $aBorders = array(); $aStyles = $this->allStyles($pPHPExcel); + /** @var \PHPExcel\Style $style */ foreach ($aStyles as $style) { if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) { $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders(); @@ -675,16 +679,17 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa /** * Get an array of all number formats * - * @param PHPExcel $pPHPExcel - * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return \PHPExcel\Style\NumberFormat[] All number formats in PHPExcel + * @throws \PHPExcel\Writer\Exception */ - public function allNumberFormats(PHPExcel $pPHPExcel = null) + public function allNumberFormats(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Get an array of unique number formats $aNumFmts = array(); $aStyles = $this->allStyles($pPHPExcel); + /** @var \PHPExcel\Style $style */ foreach ($aStyles as $style) { if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) { $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat(); diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php index 223e4024..433f8d64 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Theme.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Theme.php @@ -1,4 +1,5 @@ '0000FF', 'folHlink' => '800080', ); - + /** * Write theme to XML format * - * @param PHPExcel $pPHPExcel - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\SpreadSheet $pPHPExcel + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ - public function writeTheme(PHPExcel $pPHPExcel = null) + public function writeTheme(\PHPExcel\SpreadSheet $pPHPExcel = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -816,11 +817,11 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa /** * Write fonts to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter + * @param \PHPExcel\Shared\XMLWriter $objWriter * @param string $latinFont * @param array of string $fontSet - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ private function writeFonts($objWriter, $latinFont, $fontSet) { @@ -850,9 +851,9 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa /** * Write colour scheme to XML format * - * @param PHPExcel_Shared_XMLWriter $objWriter - * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter + * @return string XML Output + * @throws \PHPExcel\Writer\Exception */ private function writeColourScheme($objWriter) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php index 87c877ea..7134efcb 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Workbook.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -86,10 +87,10 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write file version * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @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 = null) { $objWriter->startElement('fileVersion'); $objWriter->writeAttribute('appName', 'xl'); @@ -102,14 +103,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write WorkbookPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws PHPExcel_Writer_Exception + * @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 = null) { $objWriter->startElement('workbookPr'); - if (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) { + if (\PHPExcel\Shared\Date::getExcelCalendar() == \PHPExcel\Shared\Date::CALENDAR_MAC_1904) { $objWriter->writeAttribute('date1904', '1'); } @@ -121,11 +122,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write BookViews * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function writeBookViews(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) { // bookViews $objWriter->startElement('bookViews'); @@ -151,11 +152,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write WorkbookProtection * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function writeWorkbookProtection(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) { if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { $objWriter->startElement('workbookProtection'); @@ -178,11 +179,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write calcPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true) + private function writeCalcPr(\PHPExcel\Shared\XMLWriter $objWriter = null, $recalcRequired = true) { $objWriter->startElement('calcPr'); @@ -201,11 +202,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write sheets * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function writeSheets(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) { // Write sheets $objWriter->startElement('sheets'); @@ -227,14 +228,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write sheet * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param string $pSheetname Sheet name * @param int $pSheetId Sheet id * @param int $pRelId Relationship ID * @param string $sheetState Sheet state (visible, hidden, veryHidden) - * @throws PHPExcel_Writer_Exception + * @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 = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') { if ($pSheetname != '') { // Write sheet @@ -247,18 +248,18 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->writeAttribute('r:id', 'rId' . $pRelId); $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } /** * Write Defined Names * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) + private function writeDefinedNames(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel = null) { // Write defined names $objWriter->startElement('definedNames'); @@ -288,11 +289,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write named ranges * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) + private function writeNamedRanges(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\SpreadSheet $pPHPExcel) { // Loop named ranges $namedRanges = $pPHPExcel->getNamedRanges(); @@ -304,11 +305,11 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for named range * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer * @param PHPExcel_NamedRange $pNamedRange - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) + private function writeDefinedNameForNamedRange(\PHPExcel\Shared\XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) { // definedName for named range $objWriter->startElement('definedName'); @@ -318,14 +319,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write } // Create absolute coordinate and write as raw text - $range = PHPExcel_Cell::splitRange($pNamedRange->getRange()); + $range = \PHPExcel\Cell::splitRange($pNamedRange->getRange()); for ($i = 0; $i < count($range); $i++) { - $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]); + $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . \PHPExcel\Cell::absoluteReference($range[$i][0]); if (isset($range[$i][1])) { - $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]); + $range[$i][1] = \PHPExcel\Cell::absoluteReference($range[$i][1]); } } - $range = PHPExcel_Cell::buildRange($range); + $range = \PHPExcel\Cell::buildRange($range); $objWriter->writeRawData($range); @@ -335,12 +336,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for autoFilter * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @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 = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for autoFilter $autoFilterRange = $pSheet->getAutoFilter()->getRange(); @@ -351,15 +352,15 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->writeAttribute('hidden', '1'); // Create absolute coordinate and write as raw text - $range = PHPExcel_Cell::splitRange($autoFilterRange); + $range = \PHPExcel\Cell::splitRange($autoFilterRange); $range = $range[0]; // Strip any worksheet ref so we can make the cell ref absolute if (strpos($range[0], '!') !== false) { list($ws, $range[0]) = explode('!', $range[0]); } - $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]); - $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]); + $range[0] = \PHPExcel\Cell::absoluteCoordinate($range[0]); + $range[1] = \PHPExcel\Cell::absoluteCoordinate($range[1]); $range = implode(':', $range); $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range); @@ -371,12 +372,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for PrintTitles * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @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 = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintTitles if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { @@ -414,12 +415,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write /** * Write Defined Name for PrintTitles * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet * @param int $pSheetId - * @throws PHPExcel_Writer_Exception + * @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 = null, \PHPExcel\Worksheet $pSheet = null, $pSheetId = 0) { // definedName for PrintArea if ($pSheet->getPageSetup()->isPrintAreaSet()) { @@ -431,12 +432,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $settingString = ''; // Print area - $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); + $printArea = \PHPExcel\Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); $chunks = array(); foreach ($printArea as $printAreaRect) { - $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]); - $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]); + $printAreaRect[0] = \PHPExcel\Cell::absoluteReference($printAreaRect[0]); + $printAreaRect[1] = \PHPExcel\Cell::absoluteReference($printAreaRect[1]); $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect); } diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php b/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php index 290bbe77..ae50fd26 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Worksheet.php @@ -1,4 +1,5 @@ getParentWriter()->getUseDiskCaching()) { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { - $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + $objWriter = new \PHPExcel\Shared\XMLWriter(\PHPExcel\Shared\XMLWriter::STORAGE_MEMORY); } // XML header @@ -132,18 +133,18 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Return return $objWriter->getData(); } else { - throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); + throw new \PHPExcel\Writer\Exception("Invalid \\PHPExcel\\Worksheet object passed."); } } /** * Write SheetPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeSheetPr(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // sheetPr $objWriter->startElement('sheetPr'); @@ -186,11 +187,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Dimension * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeDimension(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // dimension $objWriter->startElement('dimension'); @@ -201,11 +202,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetViews * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeSheetViews(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // sheetViews $objWriter->startElement('sheetViews'); @@ -230,7 +231,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ } // View Layout Type - if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) { + if ($pSheet->getSheetView()->getView() !== \PHPExcel\Worksheet\SheetView::SHEETVIEW_NORMAL) { $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); } @@ -263,8 +264,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Calculate freeze coordinates $xSplit = $ySplit = 0; - list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell); - $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit); + list($xSplit, $ySplit) = \PHPExcel\Cell::coordinateFromString($topLeftCell); + $xSplit = \PHPExcel\Cell::columnIndexFromString($xSplit); // pane $pane = 'topRight'; @@ -313,11 +314,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetFormatPr * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeSheetFormatPr(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // sheetFormatPr $objWriter->startElement('sheetFormatPr'); @@ -325,7 +326,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Default row height if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { $objWriter->writeAttribute('customHeight', 'true'); - $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); + $objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); } else { $objWriter->writeAttribute('defaultRowHeight', '14.4'); } @@ -338,7 +339,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Default column width if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { - $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); + $objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); } // Outline level - row @@ -365,11 +366,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Cols * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeCols(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // cols if (count($pSheet->getColumnDimensions()) > 0) { @@ -381,15 +382,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ foreach ($pSheet->getColumnDimensions() as $colDimension) { // col $objWriter->startElement('col'); - $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); - $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('min', \PHPExcel\Cell::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('max', \PHPExcel\Cell::columnIndexFromString($colDimension->getColumnIndex())); if ($colDimension->getWidth() < 0) { // No width set, apply default of 10 $objWriter->writeAttribute('width', '9.10'); } else { // Width set - $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth())); + $objWriter->writeAttribute('width', \PHPExcel\Shared\String::FormatNumber($colDimension->getWidth())); } // Column visibility @@ -430,11 +431,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetProtection * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeSheetProtection(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // sheetProtection $objWriter->startElement('sheetProtection'); @@ -465,11 +466,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write ConditionalFormatting * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeConditionalFormatting(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // Conditional id $id = 1; @@ -481,7 +482,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') { // continue; // } - if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) { + if ($conditional->getConditionType() != \PHPExcel\Style\Conditional::CONDITION_NONE) { // conditionalFormatting $objWriter->startElement('conditionalFormatting'); $objWriter->writeAttribute('sqref', $cellCoordinate); @@ -492,35 +493,35 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode())); $objWriter->writeAttribute('priority', $id++); - if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) - && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) { + if (($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CELLIS || $conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT) + && $conditional->getOperatorType() != \PHPExcel\Style\Conditional::OPERATOR_NONE) { $objWriter->writeAttribute('operator', $conditional->getOperatorType()); } - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT + if ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT && !is_null($conditional->getText())) { $objWriter->writeAttribute('text', $conditional->getText()); } - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT + if ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == \PHPExcel\Style\Conditional::OPERATOR_CONTAINSTEXT && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); - } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH + } elseif ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == \PHPExcel\Style\Conditional::OPERATOR_BEGINSWITH && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); - } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH + } elseif ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == \PHPExcel\Style\Conditional::OPERATOR_ENDSWITH && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); - } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS + } elseif ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == \PHPExcel\Style\Conditional::OPERATOR_NOTCONTAINS && !is_null($conditional->getText())) { $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); - } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { + } elseif ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CELLIS + || $conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CONTAINSTEXT + || $conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_EXPRESSION) { foreach ($conditional->getConditions() as $formula) { // Formula $objWriter->writeElement('formula', $formula); @@ -538,11 +539,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write DataValidations * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeDataValidations(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // Datavalidation collection $dataValidationCollection = $pSheet->getDataValidationCollection(); @@ -604,11 +605,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Hyperlinks * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeHyperlinks(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // Hyperlink collection $hyperlinkCollection = $pSheet->getHyperlinkCollection(); @@ -645,11 +646,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write ProtectedRanges * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeProtectedRanges(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { if (count($pSheet->getProtectedCells()) > 0) { // protectedRanges @@ -674,11 +675,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write MergeCells * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeMergeCells(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { if (count($pSheet->getMergeCells()) > 0) { // mergeCells @@ -699,11 +700,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PrintOptions * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writePrintOptions(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // printOptions $objWriter->startElement('printOptions'); @@ -725,31 +726,31 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PageMargins * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writePageMargins(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // pageMargins $objWriter->startElement('pageMargins'); - $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); - $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); - $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); - $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); - $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); - $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); + $objWriter->writeAttribute('left', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getLeft())); + $objWriter->writeAttribute('right', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getRight())); + $objWriter->writeAttribute('top', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getTop())); + $objWriter->writeAttribute('bottom', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getBottom())); + $objWriter->writeAttribute('header', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getHeader())); + $objWriter->writeAttribute('footer', \PHPExcel\Shared\String::FormatNumber($pSheet->getPageMargins()->getFooter())); $objWriter->endElement(); } /** * Write AutoFilter * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeAutoFilter(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { $autoFilterRange = $pSheet->getAutoFilter()->getRange(); if (!empty($autoFilterRange)) { @@ -757,7 +758,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('autoFilter'); // Strip any worksheet reference from the filter coordinates - $range = PHPExcel_Cell::splitRange($autoFilterRange); + $range = \PHPExcel\Cell::splitRange($autoFilterRange); $range = $range[0]; // Strip any worksheet ref if (strpos($range[0], '!') !== false) { @@ -776,17 +777,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID)); $objWriter->startElement($column->getFilterType()); - if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) { + if ($column->getJoin() == \PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND) { $objWriter->writeAttribute('and', 1); } foreach ($rules as $rule) { - if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) && - ($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && + if (($column->getFilterType() === \PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) && + ($rule->getOperator() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && ($rule->getValue() === '')) { // Filter rule for Blanks $objWriter->writeAttribute('blank', 1); - } elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { + } elseif ($rule->getRuleType() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { // Dynamic Filter Rule $objWriter->writeAttribute('type', $rule->getGrouping()); $val = $column->getAttribute('val'); @@ -797,19 +798,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ if ($maxVal !== null) { $objWriter->writeAttribute('maxVal', $maxVal); } - } elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) { + } elseif ($rule->getRuleType() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) { // Top 10 Filter Rule $objWriter->writeAttribute('val', $rule->getValue()); - $objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); - $objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0')); + $objWriter->writeAttribute('percent', (($rule->getOperator() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); + $objWriter->writeAttribute('top', (($rule->getGrouping() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0')); } else { // Filter, DateGroupItem or CustomFilter $objWriter->startElement($rule->getRuleType()); - if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) { + if ($rule->getOperator() !== \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL) { $objWriter->writeAttribute('operator', $rule->getOperator()); } - if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) { + if ($rule->getRuleType() === \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP) { // Date Group filters foreach ($rule->getValue() as $key => $value) { if ($value > '') { @@ -838,11 +839,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write PageSetup * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writePageSetup(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // pageSetup $objWriter->startElement('pageSetup'); @@ -873,11 +874,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Header / Footer * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeHeaderFooter(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // headerFooter $objWriter->startElement('headerFooter'); @@ -898,19 +899,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write Breaks * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeBreaks(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // Get row and column breaks $aRowBreaks = array(); $aColumnBreaks = array(); foreach ($pSheet->getBreaks() as $cell => $breakType) { - if ($breakType == PHPExcel_Worksheet::BREAK_ROW) { + if ($breakType == \PHPExcel\Worksheet::BREAK_ROW) { $aRowBreaks[] = $cell; - } elseif ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) { + } elseif ($breakType == \PHPExcel\Worksheet::BREAK_COLUMN) { $aColumnBreaks[] = $cell; } } @@ -922,7 +923,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); foreach ($aRowBreaks as $cell) { - $coords = PHPExcel_Cell::coordinateFromString($cell); + $coords = \PHPExcel\Cell::coordinateFromString($cell); $objWriter->startElement('brk'); $objWriter->writeAttribute('id', $coords[1]); @@ -940,10 +941,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); foreach ($aColumnBreaks as $cell) { - $coords = PHPExcel_Cell::coordinateFromString($cell); + $coords = \PHPExcel\Cell::coordinateFromString($cell); $objWriter->startElement('brk'); - $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1); + $objWriter->writeAttribute('id', \PHPExcel\Cell::columnIndexFromString($coords[0]) - 1); $objWriter->writeAttribute('man', '1'); $objWriter->endElement(); } @@ -955,12 +956,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write SheetData * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet * @param string[] $pStringTable String table - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null) + private function writeSheetData(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $pStringTable = null) { if (is_array($pStringTable)) { // Flipped stringtable, for faster index searching @@ -970,7 +971,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('sheetData'); // Get column count - $colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()); + $colCount = \PHPExcel\Cell::columnIndexFromString($pSheet->getHighestColumn()); // Highest row number $highestRow = $pSheet->getHighestRow(); @@ -978,7 +979,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Loop through cells $cellsByRow = array(); foreach ($pSheet->getCellCollection() as $cellID) { - $cellAddress = PHPExcel_Cell::coordinateFromString($cellID); + $cellAddress = \PHPExcel\Cell::coordinateFromString($cellID); $cellsByRow[$cellAddress[1]][] = $cellID; } @@ -999,7 +1000,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Row dimensions if ($rowDimension->getRowHeight() >= 0) { $objWriter->writeAttribute('customHeight', '1'); - $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight())); + $objWriter->writeAttribute('ht', \PHPExcel\Shared\String::FormatNumber($rowDimension->getRowHeight())); } // Row visibility @@ -1038,21 +1039,21 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } /** * Write Cell * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @param PHPExcel_Cell $pCellAddress Cell Address + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @param \PHPExcel\Cell $pCellAddress Cell Address * @param string[] $pStringTable String table * @param string[] $pFlippedStringTable String table (flipped), for faster index searching - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) + private function writeCell(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) { if (is_array($pStringTable) && is_array($pFlippedStringTable)) { // Cell @@ -1093,9 +1094,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Write data depending on its type switch (strtolower($mappedType)) { case 'inlinestr': // Inline string - if (! $cellValue instanceof PHPExcel_RichText) { - $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); - } elseif ($cellValue instanceof PHPExcel_RichText) { + if (! $cellValue instanceof \PHPExcel\RichText) { + $objWriter->writeElement('t', \PHPExcel\Shared\String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); + } elseif ($cellValue instanceof \PHPExcel\RichText) { $objWriter->startElement('is'); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); $objWriter->endElement(); @@ -1103,11 +1104,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ break; case 's': // String - if (! $cellValue instanceof PHPExcel_RichText) { + if (! $cellValue instanceof \PHPExcel\RichText) { if (isset($pFlippedStringTable[$cellValue])) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); } - } elseif ($cellValue instanceof PHPExcel_RichText) { + } elseif ($cellValue instanceof \PHPExcel\RichText) { $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]); } @@ -1129,7 +1130,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ if ($this->getParentWriter()->getPreCalculateFormulas()) { // $calculatedValue = $pCell->getCalculatedValue(); if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { - $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue)); + $objWriter->writeElement('v', \PHPExcel\Shared\String::FormatNumber($calculatedValue)); } else { $objWriter->writeElement('v', '0'); } @@ -1159,19 +1160,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } /** * Write Drawings * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet * @param boolean $includeCharts Flag indicating if we should include drawing details for charts - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false) + private function writeDrawings(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null, $includeCharts = false) { $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0; // If sheet contains drawings, add the relationships @@ -1186,11 +1187,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write LegacyDrawing * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeLegacyDrawing(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // If sheet contains comments, add the relationships if (count($pSheet->getComments()) > 0) { @@ -1203,11 +1204,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ /** * Write LegacyDrawingHF * - * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Shared\XMLWriter $objWriter XML Writer + * @param \PHPExcel\Worksheet $pSheet Worksheet + * @throws \PHPExcel\Writer\Exception */ - private function writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) + private function writeLegacyDrawingHF(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null) { // If sheet contains images, add the relationships if (count($pSheet->getHeaderFooter()->getImages()) > 0) { diff --git a/src/PhpSpreadsheet/Writer/Excel2007/WriterPart.php b/src/PhpSpreadsheet/Writer/Excel2007/WriterPart.php index ca04f650..83f97326 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/WriterPart.php @@ -3,7 +3,7 @@ namespace PHPExcel\Writer\Excel2007; /** - * PHPExcel_Writer_Excel2007_WriterPart + * \PHPExcel\Writer\Excel2007\WriterPart * * Copyright (c) 2006 - 2015 PHPExcel * @@ -58,7 +58,7 @@ abstract class WriterPart if (!is_null($this->parentWriter)) { return $this->parentWriter; } else { - throw new \PHPExcel\Writer\Exception("No parent \PHPExcel\Writer\IWriter assigned."); + throw new \PHPExcel\Writer\Exception("No parent \\PHPExcel\\Writer\\IWriter assigned."); } } diff --git a/src/PhpSpreadsheet/Writer/Excel5.php b/src/PhpSpreadsheet/Writer/Excel5.php index 2dede819..d204ae72 100644 --- a/src/PhpSpreadsheet/Writer/Excel5.php +++ b/src/PhpSpreadsheet/Writer/Excel5.php @@ -106,7 +106,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { @@ -116,8 +116,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog(); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false); - $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveDateReturnType = \PHPExcel\Calculation\Functions::getReturnDateType(); + \PHPExcel\Calculation\Functions::setReturnDateType(\PHPExcel\Calculation\Functions::RETURNDATE_EXCEL); // initialize colors array $this->colors = array(); @@ -152,10 +152,10 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce foreach ($this->writerWorksheets[$i]->phpSheet->getCellCollection() as $cellID) { $cell = $this->writerWorksheets[$i]->phpSheet->getCell($cellID); $cVal = $cell->getValue(); - if ($cVal instanceof PHPExcel_RichText) { + if ($cVal instanceof \PHPExcel\RichText) { $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof \PHPExcel\RichText\Run) { $font = $element->getFont(); $this->writerWorksheets[$i]->fontHashIndex[$font->getHashCode()] = $this->writerWorkbook->addFont($font); } @@ -213,7 +213,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce // save the OLE file $res = $root->save($pFilename); - PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); + \PHPExcel\Calculation\Functions::setReturnDateType($saveDateReturnType); PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } @@ -222,7 +222,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce * * @deprecated * @param string $pValue Temporary storage directory - * @throws PHPExcel_Writer_Exception when directory does not exist + * @throws \PHPExcel\Writer\Exception when directory does not exist * @return PHPExcel_Writer_Excel5 */ public function setTempDir($pValue = '') @@ -337,7 +337,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce ++$countShapes[$sheetIndex]; // create an Drawing Object for the dropdown - $oDrawing = new PHPExcel_Worksheet_BaseDrawing(); + $oDrawing = new \PHPExcel\Worksheet\BaseDrawing(); // get the coordinates of drawing $cDrawing = PHPExcel_Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1]; $oDrawing->setCoordinates($cDrawing); @@ -458,7 +458,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce // the BSE's (all the images) foreach ($this->phpExcel->getAllsheets() as $sheet) { foreach ($sheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing instanceof \PHPExcel\Worksheet\Drawing) { $filename = $drawing->getPath(); list($imagesx, $imagesy, $imageFormat) = getimagesize($filename); @@ -482,7 +482,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce case 6: // Windows DIB (BMP), we convert to PNG $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; ob_start(); - imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename)); + imagepng(\PHPExcel\Shared\Drawing::imagecreatefrombmp($filename)); $blipData = ob_get_contents(); ob_end_clean(); break; @@ -498,15 +498,15 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce $BSE->setBlip($blip); $bstoreContainer->addBSE($BSE); - } elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) { + } elseif ($drawing instanceof \PHPExcel\Worksheet\MemoryDrawing) { switch ($drawing->getRenderingFunction()) { - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: + case \PHPExcel\Worksheet\MemoryDrawing::RENDERING_JPEG: $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; $renderingFunction = 'imagejpeg'; break; - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: + case \PHPExcel\Worksheet\MemoryDrawing::RENDERING_GIF: + case \PHPExcel\Worksheet\MemoryDrawing::RENDERING_PNG: + case \PHPExcel\Worksheet\MemoryDrawing::RENDERING_DEFAULT: $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; $renderingFunction = 'imagepng'; break; diff --git a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php b/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php index a7957523..2549ef52 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php +++ b/src/PhpSpreadsheet/Writer/Excel5/BIFFwriter.php @@ -114,7 +114,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter $byte_order = 1; // Big Endian } else { // Give up. I'll fix this in a later version. - throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform."); + throw new \PHPExcel\Writer\Exception("Required floating point format not supported on this platform."); } self::$byteOrder = $byte_order; } diff --git a/src/PhpSpreadsheet/Writer/Excel5/Font.php b/src/PhpSpreadsheet/Writer/Excel5/Font.php index ed85ff45..dc3c6d71 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Font.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Font.php @@ -37,16 +37,16 @@ class PHPExcel_Writer_Excel5_Font /** * Font * - * @var PHPExcel_Style_Font + * @var \PHPExcel\Style\Font */ private $font; /** * Constructor * - * @param PHPExcel_Style_Font $font + * @param \PHPExcel\Style\Font $font */ - public function __construct(PHPExcel_Style_Font $font = null) + public function __construct(\PHPExcel\Style\Font $font = null) { $this->colorIndex = 0x7FFF; $this->font = $font; @@ -143,11 +143,11 @@ class PHPExcel_Writer_Excel5_Font * */ private static $mapUnderline = array( - PHPExcel_Style_Font::UNDERLINE_NONE => 0x00, - PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01, - PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02, - PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21, - PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22, + \PHPExcel\Style\Font::UNDERLINE_NONE => 0x00, + \PHPExcel\Style\Font::UNDERLINE_SINGLE => 0x01, + \PHPExcel\Style\Font::UNDERLINE_DOUBLE => 0x02, + \PHPExcel\Style\Font::UNDERLINE_SINGLEACCOUNTING => 0x21, + \PHPExcel\Style\Font::UNDERLINE_DOUBLEACCOUNTING => 0x22, ); /** diff --git a/src/PhpSpreadsheet/Writer/Excel5/Parser.php b/src/PhpSpreadsheet/Writer/Excel5/Parser.php index 0cf1c1d6..3129fc60 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Parser.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Parser.php @@ -556,7 +556,7 @@ class PHPExcel_Writer_Excel5_Parser } // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown token $token"); + throw new \PHPExcel\Writer\Exception("Unknown token $token"); } /** @@ -590,7 +590,7 @@ class PHPExcel_Writer_Excel5_Parser // chop away beggining and ending quotes $string = substr($string, 1, strlen($string) - 2); if (strlen($string) > 255) { - throw new PHPExcel_Writer_Exception("String is too long"); + throw new \PHPExcel\Writer\Exception("String is too long"); } return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string); @@ -636,7 +636,7 @@ class PHPExcel_Writer_Excel5_Parser list($cell1, $cell2) = explode(':', $range); } else { // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown range separator"); + throw new \PHPExcel\Writer\Exception("Unknown range separator"); } // Convert the cell references @@ -652,7 +652,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgArea = pack("C", $this->ptg['ptgAreaA']); } else { // TODO: use real error codes - throw new PHPExcel_Writer_Exception("Unknown class $class"); + throw new \PHPExcel\Writer\Exception("Unknown class $class"); } return $ptgArea . $row1 . $row2 . $col1. $col2; } @@ -694,7 +694,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { // $ptgArea = pack("C", $this->ptg['ptgArea3dA']); // } else { -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new \PHPExcel\Writer\Exception("Unknown class $class"); // } return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2; @@ -724,7 +724,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgRef = pack("C", $this->ptg['ptgRefA']); // } else { // // TODO: use real error codes -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new \PHPExcel\Writer\Exception("Unknown class $class"); // } return $ptgRef.$row.$col; } @@ -758,7 +758,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { $ptgRef = pack("C", $this->ptg['ptgRef3dA']); // } else { -// throw new PHPExcel_Writer_Exception("Unknown class $class"); +// throw new \PHPExcel\Writer\Exception("Unknown class $class"); // } return $ptgRef . $ext_ref. $row . $col; @@ -811,11 +811,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -825,7 +825,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -857,11 +857,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -871,7 +871,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); + throw new \PHPExcel\Writer\Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -941,10 +941,10 @@ class PHPExcel_Writer_Excel5_Parser $cell = strtoupper($cell); list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell); if ($col >= 256) { - throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255"); + throw new \PHPExcel\Writer\Exception("Column in: $cell greater than 255"); } if ($row >= 65536) { - throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 "); + throw new \PHPExcel\Writer\Exception("Row in: $cell greater than 65536 "); } // Set the high bits to indicate if row or col are relative. @@ -982,7 +982,7 @@ class PHPExcel_Writer_Excel5_Parser // FIXME: this changes for BIFF8 if (($row1 >= 65536) or ($row2 >= 65536)) { - throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 "); + throw new \PHPExcel\Writer\Exception("Row in: $range greater than 65536 "); } // Set the high bits to indicate if rows are relative. @@ -1342,7 +1342,7 @@ class PHPExcel_Writer_Excel5_Parser $this->advance(); // eat the "(" $result = $this->parenthesizedExpression(); if ($this->currentToken != ")") { - throw new PHPExcel_Writer_Exception("')' token expected."); + throw new \PHPExcel\Writer\Exception("')' token expected."); } $this->advance(); // eat the ")" return $result; @@ -1398,7 +1398,7 @@ class PHPExcel_Writer_Excel5_Parser $result = $this->func(); return $result; } - throw new PHPExcel_Writer_Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter); + throw new \PHPExcel\Writer\Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter); } /** @@ -1421,7 +1421,7 @@ class PHPExcel_Writer_Excel5_Parser if ($this->currentToken == "," || $this->currentToken == ";") { $this->advance(); // eat the "," or ";" } else { - throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}"); + throw new \PHPExcel\Writer\Exception("Syntax error: comma expected in function $function, arg #{$num_args}"); } $result2 = $this->condition(); $result = $this->createTree('arg', $result, $result2); @@ -1432,12 +1432,12 @@ class PHPExcel_Writer_Excel5_Parser ++$num_args; } if (!isset($this->functions[$function])) { - throw new PHPExcel_Writer_Exception("Function $function() doesn't exist"); + throw new \PHPExcel\Writer\Exception("Function $function() doesn't exist"); } $args = $this->functions[$function][1]; // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid. if (($args >= 0) and ($args != $num_args)) { - throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() "); + throw new \PHPExcel\Writer\Exception("Incorrect number of arguments in function $function() "); } $result = $this->createTree($function, $result, $num_args); diff --git a/src/PhpSpreadsheet/Writer/Excel5/Workbook.php b/src/PhpSpreadsheet/Writer/Excel5/Workbook.php index 8b068437..660b5661 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Workbook.php @@ -287,10 +287,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Add a font to added fonts * - * @param PHPExcel_Style_Font $font + * @param \PHPExcel\Style\Font $font * @return int Index to FONT record */ - public function addFont(PHPExcel_Style_Font $font) + public function addFont(\PHPExcel\Style\Font $font) { $fontHashCode = $font->getHashCode(); if (isset($this->addedFonts[$fontHashCode])) { @@ -907,7 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Writes Excel BIFF BOUNDSHEET record. * - * @param PHPExcel_Worksheet $sheet Worksheet name + * @param \PHPExcel\Worksheet $sheet Worksheet name * @param integer $offset Location of worksheet BOF */ private function writeBoundSheet($sheet, $offset) @@ -917,13 +917,13 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter // sheet state switch ($sheet->getSheetState()) { - case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: + case \PHPExcel\Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break; - case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: + case \PHPExcel\Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break; - case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: + case \PHPExcel\Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break; default: diff --git a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php index be965e23..de3b29ab 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php @@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Sheet object - * @var PHPExcel_Worksheet + * @var \PHPExcel\Worksheet */ public $phpSheet; @@ -201,7 +201,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter * @param mixed $parser The formula parser created for the Workbook * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written * @param string $phpSheet The worksheet to write - * @param PHPExcel_Worksheet $phpSheet + * @param \PHPExcel\Worksheet $phpSheet */ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) { @@ -398,7 +398,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs $cVal = $cell->getValue(); - if ($cVal instanceof PHPExcel_RichText) { + if ($cVal instanceof \PHPExcel\RichText) { // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex); $arrcRun = array(); $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8'); @@ -406,7 +406,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { // FONT Index - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof \PHPExcel\RichText\Run) { $str_fontidx = $this->fontHashIndex[$element->getFont()->getHashCode()]; } else { $str_fontidx = 0; @@ -418,8 +418,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); } else { switch ($cell->getDatatype()) { - case PHPExcel_Cell_DataType::TYPE_STRING: - case PHPExcel_Cell_DataType::TYPE_NULL: + case \PHPExcel\Cell\DataType::TYPE_STRING: + case \PHPExcel\Cell\DataType::TYPE_NULL: if ($cVal === '' || $cVal === null) { $this->writeBlank($row, $column, $xfIndex); } else { @@ -427,21 +427,21 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } break; - case PHPExcel_Cell_DataType::TYPE_NUMERIC: + case \PHPExcel\Cell\DataType::TYPE_NUMERIC: $this->writeNumber($row, $column, $cVal, $xfIndex); break; - case PHPExcel_Cell_DataType::TYPE_FORMULA: + case \PHPExcel\Cell\DataType::TYPE_FORMULA: $calculatedValue = $this->_preCalculateFormulas ? $cell->getCalculatedValue() : null; $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue); break; - case PHPExcel_Cell_DataType::TYPE_BOOL: + case \PHPExcel\Cell\DataType::TYPE_BOOL: $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex); break; - case PHPExcel_Cell_DataType::TYPE_ERROR: + case \PHPExcel\Cell\DataType::TYPE_ERROR: $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex); break; @@ -508,8 +508,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Write ConditionalFormattingTable records foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + if ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CELLIS) { if (!in_array($conditional->getHashCode(), $arrConditional)) { $arrConditional[] = $conditional->getHashCode(); // Write CFRULE record @@ -853,7 +853,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Numeric value $num = pack('d', $calculatedValue); } elseif (is_string($calculatedValue)) { - if (array_key_exists($calculatedValue, PHPExcel_Cell_DataType::getErrorCodes())) { + if (array_key_exists($calculatedValue, \PHPExcel\Cell\DataType::getErrorCodes())) { // Error value $num = pack('CCCvCv', 0x02, 0x00, self::mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF); } elseif ($calculatedValue === '') { @@ -1274,7 +1274,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0; $fPaged = 1; // 2 - $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; + $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === \PHPExcel\Worksheet\SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; $grbit = $fDspFmla; $grbit |= $fDspGrid << 1; @@ -1795,7 +1795,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $fLeftToRight = 0x0; // Print over then down // Page orientation - $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? + $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 0x0 : 0x1; $fNoPls = 0x0; // Setup not read from printer @@ -2146,15 +2146,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Decide what to do by the type of break switch ($breakType) { - case PHPExcel_Worksheet::BREAK_COLUMN: + case \PHPExcel\Worksheet::BREAK_COLUMN: // Add to list of vertical breaks $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1; break; - case PHPExcel_Worksheet::BREAK_ROW: + case \PHPExcel\Worksheet::BREAK_ROW: // Add to list of horizontal breaks $hbreaks[] = $coordinates[1]; break; - case PHPExcel_Worksheet::BREAK_NONE: + case \PHPExcel\Worksheet::BREAK_NONE: default: // Nothing to do break; @@ -2564,7 +2564,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Open file. $bmp_fd = @fopen($bitmap, "rb"); if (!$bmp_fd) { - throw new PHPExcel_Writer_Exception("Couldn't import $bitmap"); + throw new \PHPExcel\Writer\Exception("Couldn't import $bitmap"); } // Slurp the file into a string. @@ -2572,13 +2572,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Check that the file is big enough to be a bitmap. if (strlen($data) <= 0x36) { - throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap doesn't contain enough data.\n"); } // The first 2 bytes are used to identify the bitmap. $identity = unpack("A2ident", $data); if ($identity['ident'] != "BM") { - throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); } // Remove bitmap data: ID. @@ -2602,20 +2602,20 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $height = $width_and_height[2]; $data = substr($data, 8); if ($width > 0xFFFF) { - throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap: largest image width supported is 65k.\n"); } if ($height > 0xFFFF) { - throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap: largest image height supported is 65k.\n"); } // Read and remove the bitmap planes and bpp data. Verify them. $planes_and_bitcount = unpack("v2", substr($data, 0, 4)); $data = substr($data, 4); if ($planes_and_bitcount[2] != 24) { // Bitcount - throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap isn't a 24bit true color bitmap.\n"); } if ($planes_and_bitcount[1] != 1) { - throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap: only 1 plane supported in bitmap image.\n"); } // Read and remove the bitmap compression. Verify compression. @@ -2624,7 +2624,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //$compression = 0; if ($compression['comp'] != 0) { - throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n"); + throw new \PHPExcel\Writer\Exception("$bitmap: compression not supported in bitmap image.\n"); } // Remove bitmap data: data size, hres, vres, colours, imp. colours. @@ -2928,7 +2928,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter try { $formula2 = $dataValidation->getFormula2(); if ($formula2 === '') { - throw new PHPExcel_Writer_Exception('No formula2'); + throw new \PHPExcel\Writer\Exception('No formula2'); } $this->parser->parse($formula2); $formula2 = $this->parser->toReversePolish(); @@ -2994,7 +2994,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $wScalvePLV = $this->phpSheet->getSheetView()->getZoomScale(); // 2 // The options flags that comprise $grbit - if ($this->phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { + if ($this->phpSheet->getSheetView()->getView() == \PHPExcel\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT) { $fPageLayoutView = 1; } else { $fPageLayoutView = 0; @@ -3013,43 +3013,43 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter /** * Write CFRule Record - * @param PHPExcel_Style_Conditional $conditional + * @param \PHPExcel\Style\Conditional $conditional */ - private function writeCFRule(PHPExcel_Style_Conditional $conditional) + private function writeCFRule(\PHPExcel\Style\Conditional $conditional) { $record = 0x01B1; // Record identifier // $type : Type of the CF // $operatorType : Comparison operator - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { + if ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_EXPRESSION) { $type = 0x02; $operatorType = 0x00; - } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + } elseif ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CELLIS) { $type = 0x01; switch ($conditional->getOperatorType()) { - case PHPExcel_Style_Conditional::OPERATOR_NONE: + case \PHPExcel\Style\Conditional::OPERATOR_NONE: $operatorType = 0x00; break; - case PHPExcel_Style_Conditional::OPERATOR_EQUAL: + case \PHPExcel\Style\Conditional::OPERATOR_EQUAL: $operatorType = 0x03; break; - case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN: + case \PHPExcel\Style\Conditional::OPERATOR_GREATERTHAN: $operatorType = 0x05; break; - case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL: + case \PHPExcel\Style\Conditional::OPERATOR_GREATERTHANOREQUAL: $operatorType = 0x07; break; - case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN: + case \PHPExcel\Style\Conditional::OPERATOR_LESSTHAN: $operatorType = 0x06; break; - case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL: + case \PHPExcel\Style\Conditional::OPERATOR_LESSTHANOREQUAL: $operatorType = 0x08; break; - case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL: + case \PHPExcel\Style\Conditional::OPERATOR_NOTEQUAL: $operatorType = 0x04; break; - case PHPExcel_Style_Conditional::OPERATOR_BETWEEN: + case \PHPExcel\Style\Conditional::OPERATOR_BETWEEN: $operatorType = 0x01; break; // not OPERATOR_NOTBETWEEN 0x02 @@ -3065,7 +3065,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $szValue2 = 0x0000; $operand1 = pack('Cv', 0x1E, $arrConditions[0]); $operand2 = null; - } elseif ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) { + } elseif ($numConditions == 2 && ($conditional->getOperatorType() == \PHPExcel\Style\Conditional::OPERATOR_BETWEEN)) { $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); $operand1 = pack('Cv', 0x1E, $arrConditions[0]); @@ -3099,14 +3099,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $bFormatProt = 0; } // Border - $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); - $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK - && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == \PHPExcel\Style\Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == \PHPExcel\Style\Border::BORDER_NONE ? 1 : 0); + $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == \PHPExcel\Style\Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == \PHPExcel\Style\Border::BORDER_NONE ? 1 : 0); + $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == \PHPExcel\Style\Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == \PHPExcel\Style\Border::BORDER_NONE ? 1 : 0); + $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == \PHPExcel\Style\Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == \PHPExcel\Style\Border::BORDER_NONE ? 1 : 0); if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) { $bFormatBorder = 1; } else { @@ -3211,23 +3211,23 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } // Underline type switch ($conditional->getStyle()->getFont()->getUnderline()) { - case PHPExcel_Style_Font::UNDERLINE_NONE: + case \PHPExcel\Style\Font::UNDERLINE_NONE: $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLE: + case \PHPExcel\Style\Font::UNDERLINE_DOUBLE: $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING: + case \PHPExcel\Style\Font::UNDERLINE_DOUBLEACCOUNTING: $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLE: + case \PHPExcel\Style\Font::UNDERLINE_SINGLE: $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break; - case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING: + case \PHPExcel\Style\Font::UNDERLINE_SINGLEACCOUNTING: $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break; @@ -3440,22 +3440,22 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $blockAlign = 0; // Alignment and text break switch ($conditional->getStyle()->getAlignment()->getHorizontal()) { - case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: + case \PHPExcel\Style\Alignment::HORIZONTAL_GENERAL: $blockAlign = 0; break; - case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: + case \PHPExcel\Style\Alignment::HORIZONTAL_LEFT: $blockAlign = 1; break; - case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: + case \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT: $blockAlign = 3; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: + case \PHPExcel\Style\Alignment::HORIZONTAL_CENTER: $blockAlign = 2; break; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: + case \PHPExcel\Style\Alignment::HORIZONTAL_CENTER_CONTINUOUS: $blockAlign = 6; break; - case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: + case \PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY: $blockAlign = 5; break; } @@ -3465,16 +3465,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $blockAlign |= 0 << 3; } switch ($conditional->getStyle()->getAlignment()->getVertical()) { - case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: + case \PHPExcel\Style\Alignment::VERTICAL_BOTTOM: $blockAlign = 2 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_TOP: + case \PHPExcel\Style\Alignment::VERTICAL_TOP: $blockAlign = 0 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_CENTER: + case \PHPExcel\Style\Alignment::VERTICAL_CENTER: $blockAlign = 1 << 4; break; - case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: + case \PHPExcel\Style\Alignment::VERTICAL_JUSTIFY: $blockAlign = 3 << 4; break; } @@ -3500,178 +3500,178 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter if ($bFormatBorder == 1) { $blockLineStyle = 0; switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: $blockLineStyle |= 0x00; break; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: $blockLineStyle |= 0x01; break; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: $blockLineStyle |= 0x02; break; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: $blockLineStyle |= 0x03; break; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: $blockLineStyle |= 0x04; break; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: $blockLineStyle |= 0x05; break; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: $blockLineStyle |= 0x06; break; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: $blockLineStyle |= 0x07; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: $blockLineStyle |= 0x08; break; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: $blockLineStyle |= 0x09; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: $blockLineStyle |= 0x0A; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: $blockLineStyle |= 0x0B; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: $blockLineStyle |= 0x0C; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: $blockLineStyle |= 0x0D; break; } switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: $blockLineStyle |= 0x00 << 4; break; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: $blockLineStyle |= 0x01 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: $blockLineStyle |= 0x02 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: $blockLineStyle |= 0x03 << 4; break; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: $blockLineStyle |= 0x04 << 4; break; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: $blockLineStyle |= 0x05 << 4; break; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: $blockLineStyle |= 0x06 << 4; break; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: $blockLineStyle |= 0x07 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: $blockLineStyle |= 0x08 << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: $blockLineStyle |= 0x09 << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: $blockLineStyle |= 0x0A << 4; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: $blockLineStyle |= 0x0B << 4; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: $blockLineStyle |= 0x0C << 4; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: $blockLineStyle |= 0x0D << 4; break; } switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: $blockLineStyle |= 0x00 << 8; break; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: $blockLineStyle |= 0x01 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: $blockLineStyle |= 0x02 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: $blockLineStyle |= 0x03 << 8; break; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: $blockLineStyle |= 0x04 << 8; break; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: $blockLineStyle |= 0x05 << 8; break; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: $blockLineStyle |= 0x06 << 8; break; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: $blockLineStyle |= 0x07 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: $blockLineStyle |= 0x08 << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: $blockLineStyle |= 0x09 << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: $blockLineStyle |= 0x0A << 8; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: $blockLineStyle |= 0x0B << 8; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: $blockLineStyle |= 0x0C << 8; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: $blockLineStyle |= 0x0D << 8; break; } switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: $blockLineStyle |= 0x00 << 12; break; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: $blockLineStyle |= 0x01 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: $blockLineStyle |= 0x02 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: $blockLineStyle |= 0x03 << 12; break; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: $blockLineStyle |= 0x04 << 12; break; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: $blockLineStyle |= 0x05 << 12; break; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: $blockLineStyle |= 0x06 << 12; break; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: $blockLineStyle |= 0x07 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: $blockLineStyle |= 0x08 << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: $blockLineStyle |= 0x09 << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: $blockLineStyle |= 0x0A << 12; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: $blockLineStyle |= 0x0B << 12; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: $blockLineStyle |= 0x0C << 12; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: $blockLineStyle |= 0x0D << 12; break; } @@ -3684,46 +3684,46 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //@todo writeCFRule() => $blockColor => Index Color for bottom line //@todo writeCFRule() => $blockColor => Index Color for diagonal line switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: $blockColor |= 0x00 << 21; break; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: $blockColor |= 0x01 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: $blockColor |= 0x02 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: $blockColor |= 0x03 << 21; break; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: $blockColor |= 0x04 << 21; break; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: $blockColor |= 0x05 << 21; break; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: $blockColor |= 0x06 << 21; break; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: $blockColor |= 0x07 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: $blockColor |= 0x08 << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: $blockColor |= 0x09 << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: $blockColor |= 0x0A << 21; break; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: $blockColor |= 0x0B << 21; break; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: $blockColor |= 0x0C << 21; break; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: $blockColor |= 0x0D << 21; break; } @@ -3733,67 +3733,67 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Fill Patern Style $blockFillPatternStyle = 0; switch ($conditional->getStyle()->getFill()->getFillType()) { - case PHPExcel_Style_Fill::FILL_NONE: + case \PHPExcel\Style\Fill::FILL_NONE: $blockFillPatternStyle = 0x00; break; - case PHPExcel_Style_Fill::FILL_SOLID: + case \PHPExcel\Style\Fill::FILL_SOLID: $blockFillPatternStyle = 0x01; break; - case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY: + case \PHPExcel\Style\Fill::FILL_PATTERN_MEDIUMGRAY: $blockFillPatternStyle = 0x02; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKGRAY: $blockFillPatternStyle = 0x03; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTGRAY: $blockFillPatternStyle = 0x04; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKHORIZONTAL: $blockFillPatternStyle = 0x05; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKVERTICAL: $blockFillPatternStyle = 0x06; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKDOWN: $blockFillPatternStyle = 0x07; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKUP: $blockFillPatternStyle = 0x08; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKGRID: $blockFillPatternStyle = 0x09; break; - case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS: + case \PHPExcel\Style\Fill::FILL_PATTERN_DARKTRELLIS: $blockFillPatternStyle = 0x0A; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTHORIZONTAL: $blockFillPatternStyle = 0x0B; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTVERTICAL: $blockFillPatternStyle = 0x0C; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTDOWN: $blockFillPatternStyle = 0x0D; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTUP: $blockFillPatternStyle = 0x0E; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTGRID: $blockFillPatternStyle = 0x0F; break; - case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS: + case \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTTRELLIS: $blockFillPatternStyle = 0x10; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125: + case \PHPExcel\Style\Fill::FILL_PATTERN_GRAY125: $blockFillPatternStyle = 0x11; break; - case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625: + case \PHPExcel\Style\Fill::FILL_PATTERN_GRAY0625: $blockFillPatternStyle = 0x12; break; - case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR: + case \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR: $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 - case PHPExcel_Style_Fill::FILL_GRADIENT_PATH: + case \PHPExcel\Style\Fill::FILL_GRADIENT_PATH: $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 default: @@ -4153,10 +4153,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } if ($bFormatProt == 1) { $dataBlockProtection = 0; - if ($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) { + if ($conditional->getStyle()->getProtection()->getLocked() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED) { $dataBlockProtection = 1; } - if ($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) { + if ($conditional->getStyle()->getProtection()->getHidden() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED) { $dataBlockProtection = 1 << 1; } } @@ -4202,8 +4202,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $arrConditional = array(); foreach ($this->phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { foreach ($conditionalStyles as $conditional) { - if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION - || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) { + if ($conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == \PHPExcel\Style\Conditional::CONDITION_CELLIS) { if (!in_array($conditional->getHashCode(), $arrConditional)) { $arrConditional[] = $conditional->getHashCode(); } diff --git a/src/PhpSpreadsheet/Writer/Excel5/Xf.php b/src/PhpSpreadsheet/Writer/Excel5/Xf.php index e41589a8..9c14b0d0 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Xf.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Xf.php @@ -127,9 +127,9 @@ class PHPExcel_Writer_Excel5_Xf * Constructor * * @access public - * @param PHPExcel_Style The XF format + * @param \PHPExcel\Style The XF format */ - public function __construct(PHPExcel_Style $style = null) + public function __construct(\PHPExcel\Style $style = null) { $this->isStyleXf = false; $this->fontIndex = 0; @@ -228,10 +228,10 @@ class PHPExcel_Writer_Excel5_Xf $border1 |= $this->rightBorderColor << 23; $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); - $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH - || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN; - $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH - || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP; + $diag_tl_to_rb = $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_BOTH + || $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_DOWN; + $diag_tr_to_lb = $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_BOTH + || $diagonalDirection == \PHPExcel\Style\Borders::DIAGONAL_UP; $border1 |= $diag_tl_to_rb << 30; $border1 |= $diag_tr_to_lb << 31; @@ -370,20 +370,20 @@ class PHPExcel_Writer_Excel5_Xf * */ private static $mapBorderStyles = array( - PHPExcel_Style_Border::BORDER_NONE => 0x00, - PHPExcel_Style_Border::BORDER_THIN => 0x01, - PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, - PHPExcel_Style_Border::BORDER_DASHED => 0x03, - PHPExcel_Style_Border::BORDER_DOTTED => 0x04, - PHPExcel_Style_Border::BORDER_THICK => 0x05, - PHPExcel_Style_Border::BORDER_DOUBLE => 0x06, - PHPExcel_Style_Border::BORDER_HAIR => 0x07, - PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08, - PHPExcel_Style_Border::BORDER_DASHDOT => 0x09, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A, - PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B, - PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, - PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D, + \PHPExcel\Style\Border::BORDER_NONE => 0x00, + \PHPExcel\Style\Border::BORDER_THIN => 0x01, + \PHPExcel\Style\Border::BORDER_MEDIUM => 0x02, + \PHPExcel\Style\Border::BORDER_DASHED => 0x03, + \PHPExcel\Style\Border::BORDER_DOTTED => 0x04, + \PHPExcel\Style\Border::BORDER_THICK => 0x05, + \PHPExcel\Style\Border::BORDER_DOUBLE => 0x06, + \PHPExcel\Style\Border::BORDER_HAIR => 0x07, + \PHPExcel\Style\Border::BORDER_MEDIUMDASHED => 0x08, + \PHPExcel\Style\Border::BORDER_DASHDOT => 0x09, + \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT => 0x0A, + \PHPExcel\Style\Border::BORDER_DASHDOTDOT => 0x0B, + \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, + \PHPExcel\Style\Border::BORDER_SLANTDASHDOT => 0x0D, ); /** @@ -406,27 +406,27 @@ class PHPExcel_Writer_Excel5_Xf * */ private static $mapFillTypes = array( - PHPExcel_Style_Fill::FILL_NONE => 0x00, - PHPExcel_Style_Fill::FILL_SOLID => 0x01, - PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04, - PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, - PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06, - PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07, - PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08, - PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09, - PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F, - PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, - PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, - PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 - PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 + \PHPExcel\Style\Fill::FILL_NONE => 0x00, + \PHPExcel\Style\Fill::FILL_SOLID => 0x01, + \PHPExcel\Style\Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKGRAY => 0x03, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTGRAY => 0x04, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKVERTICAL => 0x06, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKDOWN => 0x07, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKUP => 0x08, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKGRID => 0x09, + \PHPExcel\Style\Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTUP => 0x0E, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTGRID => 0x0F, + \PHPExcel\Style\Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, + \PHPExcel\Style\Fill::FILL_PATTERN_GRAY125 => 0x11, + \PHPExcel\Style\Fill::FILL_PATTERN_GRAY0625 => 0x12, + \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 + \PHPExcel\Style\Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 ); /** @@ -449,13 +449,13 @@ class PHPExcel_Writer_Excel5_Xf * */ private static $mapHAlignments = array( - PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, - PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, - PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, - PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4, - PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, - PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, + \PHPExcel\Style\Alignment::HORIZONTAL_GENERAL => 0, + \PHPExcel\Style\Alignment::HORIZONTAL_LEFT => 1, + \PHPExcel\Style\Alignment::HORIZONTAL_CENTER => 2, + \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT => 3, + \PHPExcel\Style\Alignment::HORIZONTAL_FILL => 4, + \PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY => 5, + \PHPExcel\Style\Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, ); /** @@ -478,10 +478,10 @@ class PHPExcel_Writer_Excel5_Xf * */ private static $mapVAlignments = array( - PHPExcel_Style_Alignment::VERTICAL_TOP => 0, - PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, - PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, - PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, + \PHPExcel\Style\Alignment::VERTICAL_TOP => 0, + \PHPExcel\Style\Alignment::VERTICAL_CENTER => 1, + \PHPExcel\Style\Alignment::VERTICAL_BOTTOM => 2, + \PHPExcel\Style\Alignment::VERTICAL_JUSTIFY => 3, ); /** @@ -524,11 +524,11 @@ class PHPExcel_Writer_Excel5_Xf private static function mapLocked($locked) { switch ($locked) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: + case \PHPExcel\Style\Protection::PROTECTION_INHERIT: return 1; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: + case \PHPExcel\Style\Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: + case \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED: return 0; default: return 1; @@ -544,11 +544,11 @@ class PHPExcel_Writer_Excel5_Xf private static function mapHidden($hidden) { switch ($hidden) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: + case \PHPExcel\Style\Protection::PROTECTION_INHERIT: return 0; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: + case \PHPExcel\Style\Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: + case \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED: return 0; default: return 0; diff --git a/src/PhpSpreadsheet/Writer/Exception.php b/src/PhpSpreadsheet/Writer/Exception.php index a708ea18..e7ebc897 100644 --- a/src/PhpSpreadsheet/Writer/Exception.php +++ b/src/PhpSpreadsheet/Writer/Exception.php @@ -3,7 +3,7 @@ namespace PHPExcel\Writer; /** - * PHPExcel_Writer_Exception + * \PHPExcel\Writer\Exception * * Copyright (c) 2006 - 2015 PHPExcel * diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/HTML.php index fddf7b27..677031f4 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/HTML.php @@ -79,7 +79,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Default font * - * @var PHPExcel_Style_Font + * @var \PHPExcel\Style\Font */ private $defaultFont; @@ -140,7 +140,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { @@ -158,7 +158,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Open file $fileHandle = fopen($pFilename, 'wb+'); if ($fileHandle === false) { - throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + throw new \PHPExcel\Writer\Exception("Could not open file $pFilename for writing."); } // Write headers @@ -191,12 +191,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ private function mapVAlign($vAlign) { switch ($vAlign) { - case PHPExcel_Style_Alignment::VERTICAL_BOTTOM: + case \PHPExcel\Style\Alignment::VERTICAL_BOTTOM: return 'bottom'; - case PHPExcel_Style_Alignment::VERTICAL_TOP: + case \PHPExcel\Style\Alignment::VERTICAL_TOP: return 'top'; - case PHPExcel_Style_Alignment::VERTICAL_CENTER: - case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY: + case \PHPExcel\Style\Alignment::VERTICAL_CENTER: + case \PHPExcel\Style\Alignment::VERTICAL_JUSTIFY: return 'middle'; default: return 'baseline'; @@ -212,16 +212,16 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ private function mapHAlign($hAlign) { switch ($hAlign) { - case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL: + case \PHPExcel\Style\Alignment::HORIZONTAL_GENERAL: return false; - case PHPExcel_Style_Alignment::HORIZONTAL_LEFT: + case \PHPExcel\Style\Alignment::HORIZONTAL_LEFT: return 'left'; - case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT: + case \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT: return 'right'; - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER: - case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS: + case \PHPExcel\Style\Alignment::HORIZONTAL_CENTER: + case \PHPExcel\Style\Alignment::HORIZONTAL_CENTER_CONTINUOUS: return 'center'; - case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY: + case \PHPExcel\Style\Alignment::HORIZONTAL_JUSTIFY: return 'justify'; default: return false; @@ -237,33 +237,33 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ private function mapBorderStyle($borderStyle) { switch ($borderStyle) { - case PHPExcel_Style_Border::BORDER_NONE: + case \PHPExcel\Style\Border::BORDER_NONE: return 'none'; - case PHPExcel_Style_Border::BORDER_DASHDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOT: return '1px dashed'; - case PHPExcel_Style_Border::BORDER_DASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_DASHDOTDOT: return '1px dotted'; - case PHPExcel_Style_Border::BORDER_DASHED: + case \PHPExcel\Style\Border::BORDER_DASHED: return '1px dashed'; - case PHPExcel_Style_Border::BORDER_DOTTED: + case \PHPExcel\Style\Border::BORDER_DOTTED: return '1px dotted'; - case PHPExcel_Style_Border::BORDER_DOUBLE: + case \PHPExcel\Style\Border::BORDER_DOUBLE: return '3px double'; - case PHPExcel_Style_Border::BORDER_HAIR: + case \PHPExcel\Style\Border::BORDER_HAIR: return '1px solid'; - case PHPExcel_Style_Border::BORDER_MEDIUM: + case \PHPExcel\Style\Border::BORDER_MEDIUM: return '2px solid'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOT: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHDOTDOT: return '2px dotted'; - case PHPExcel_Style_Border::BORDER_MEDIUMDASHED: + case \PHPExcel\Style\Border::BORDER_MEDIUMDASHED: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_SLANTDASHDOT: + case \PHPExcel\Style\Border::BORDER_SLANTDASHDOT: return '2px dashed'; - case PHPExcel_Style_Border::BORDER_THICK: + case \PHPExcel\Style\Border::BORDER_THICK: return '3px solid'; - case PHPExcel_Style_Border::BORDER_THIN: + case \PHPExcel\Style\Border::BORDER_THIN: return '1px solid'; default: // map others to thin @@ -329,13 +329,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $pIncludeStyles Include styles? * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? if (is_null($this->phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new \PHPExcel\Writer\Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML @@ -388,13 +388,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Generate sheet data * * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function generateSheetData() { // PHPExcel object known? if (is_null($this->phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new \PHPExcel\Writer\Exception('Internal PHPExcel object not set to an instance of an object.'); } // Ensure that Spans have been calculated? @@ -507,13 +507,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * Generate sheet tabs * * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function generateNavigation() { // PHPExcel object known? if (is_null($this->phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new \PHPExcel\Writer\Exception('Internal PHPExcel object not set to an instance of an object.'); } // Fetch sheets @@ -545,7 +545,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ return $html; } - private function extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) + private function extendRowsForChartsAndImages(\PHPExcel\Worksheet $pSheet, $row) { $rowMax = $row; $colMax = 'A'; @@ -566,7 +566,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } foreach ($pSheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing instanceof \PHPExcel\Worksheet\Drawing) { $imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates()); $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]); if ($imageTL[1] > $rowMax) { @@ -599,19 +599,19 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate image tag in cell * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param \PHPExcel\Worksheet $pSheet \PHPExcel\Worksheet * @param string $coordinates Cell coordinates * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) + private function writeImageInCell(\PHPExcel\Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; // Write images foreach ($pSheet->getDrawingCollection() as $drawing) { - if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + if ($drawing instanceof \PHPExcel\Worksheet\Drawing) { if ($drawing->getCoordinates() == $coordinates) { $filename = $drawing->getPath(); @@ -664,12 +664,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate chart tag in cell * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param \PHPExcel\Worksheet $pSheet \PHPExcel\Worksheet * @param string $coordinates Cell coordinates * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) + private function writeChartInCell(\PHPExcel\Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; @@ -713,13 +713,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>) * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function generateStyles($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new \PHPExcel\Writer\Exception('Internal PHPExcel object not set to an instance of an object.'); } // Build CSS @@ -755,13 +755,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ * * @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { }) * @return array - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function buildCSS($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->phpExcel)) { - throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new \PHPExcel\Writer\Exception('Internal PHPExcel object not set to an instance of an object.'); } // Cached? @@ -847,8 +847,8 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // col elements, loop through columnDimensions and set width foreach ($sheet->getColumnDimensions() as $columnDimension) { - if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) { - $width = PHPExcel_Shared_Drawing::pixelsToPoints($width); + if (($width = \PHPExcel\Shared\Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) { + $width = \PHPExcel\Shared\Drawing::pixelsToPoints($width); $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; $this->columnWidths[$sheetIndex][$column] = $width; $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; @@ -909,10 +909,10 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Create CSS style * - * @param PHPExcel_Style $pStyle PHPExcel_Style + * @param \PHPExcel\Style $pStyle PHPExcel_Style * @return array */ - private function createCSSStyle(PHPExcel_Style $pStyle) + private function createCSSStyle(\PHPExcel\Style $pStyle) { // Construct CSS $css = ''; @@ -930,12 +930,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Alignment) + * Create CSS style (\PHPExcel\Style\Alignment) * - * @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment + * @param \PHPExcel\Style\Alignment $pStyle \PHPExcel\Style\Alignment * @return array */ - private function createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) + private function createCSSStyleAlignment(\PHPExcel\Style\Alignment $pStyle) { // Construct CSS $css = array(); @@ -953,12 +953,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Font) + * Create CSS style (\PHPExcel\Style\Font) * - * @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font + * @param \PHPExcel\Style\Font $pStyle \PHPExcel\Style\Font * @return array */ - private function createCSSStyleFont(PHPExcel_Style_Font $pStyle) + private function createCSSStyleFont(\PHPExcel\Style\Font $pStyle) { // Construct CSS $css = array(); @@ -967,9 +967,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ if ($pStyle->getBold()) { $css['font-weight'] = 'bold'; } - if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { + if ($pStyle->getUnderline() != \PHPExcel\Style\Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { $css['text-decoration'] = 'underline line-through'; - } elseif ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) { + } elseif ($pStyle->getUnderline() != \PHPExcel\Style\Font::UNDERLINE_NONE) { $css['text-decoration'] = 'underline'; } elseif ($pStyle->getStrikethrough()) { $css['text-decoration'] = 'line-through'; @@ -986,12 +986,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Borders) + * Create CSS style (\PHPExcel\Style\Borders) * - * @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders + * @param \PHPExcel\Style\Borders $pStyle \PHPExcel\Style\Borders * @return array */ - private function createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) + private function createCSSStyleBorders(\PHPExcel\Style\Borders $pStyle) { // Construct CSS $css = array(); @@ -1006,12 +1006,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Border) + * Create CSS style (\PHPExcel\Style\Border) * - * @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border + * @param \PHPExcel\Style\Border $pStyle \PHPExcel\Style\Border * @return string */ - private function createCSSStyleBorder(PHPExcel_Style_Border $pStyle) + private function createCSSStyleBorder(\PHPExcel\Style\Border $pStyle) { // Create CSS // $css = $this->mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); @@ -1023,18 +1023,18 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } /** - * Create CSS style (PHPExcel_Style_Fill) + * Create CSS style (\PHPExcel\Style\Fill) * - * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill + * @param \PHPExcel\Style\Fill $pStyle \PHPExcel\Style\Fill * @return array */ - private function createCSSStyleFill(PHPExcel_Style_Fill $pStyle) + private function createCSSStyleFill(\PHPExcel\Style\Fill $pStyle) { // Construct HTML $css = array(); // Create CSS - $value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? + $value = $pStyle->getFillType() == \PHPExcel\Style\Fill::FILL_NONE ? 'white' : '#' . $pStyle->getStartColor()->getRGB(); $css['background-color'] = $value; @@ -1057,9 +1057,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate table header * - * @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing + * @param \PHPExcel\Worksheet $pSheet The worksheet for the table we are writing * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function generateTableHeader($pSheet) { @@ -1068,7 +1068,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Construct HTML $html = ''; $html .= $this->setMargins($pSheet); - + if (!$this->useInlineCss) { $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : ''; $html .= ' ' . PHP_EOL; @@ -1104,7 +1104,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate table footer * - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ private function generateTableFooter() { @@ -1116,13 +1116,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ /** * Generate row * - * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param \PHPExcel\Worksheet $pSheet \PHPExcel\Worksheet * @param array $pValues Array containing cells in a row * @param int $pRow Row number (0-based) * @return string - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - private function generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td') + private function generateRow(\PHPExcel\Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td') { if (is_array($pValues)) { // Construct HTML @@ -1191,12 +1191,12 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $cell->attach($pSheet); } // Value - if ($cell->getValue() instanceof PHPExcel_RichText) { + if ($cell->getValue() instanceof \PHPExcel\RichText) { // Loop through rich text elements $elements = $cell->getValue()->getRichTextElements(); foreach ($elements as $element) { // Rich text start? - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof \PHPExcel\RichText\Run) { $cellData .= ''; if ($element->getFont()->getSuperScript()) { @@ -1210,7 +1210,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $cellText = $element->getText(); $cellData .= htmlspecialchars($cellText); - if ($element instanceof PHPExcel_RichText_Run) { + if ($element instanceof \PHPExcel\RichText\Run) { if ($element->getFont()->getSuperScript()) { $cellData .= ''; } elseif ($element->getFont()->getSubScript()) { @@ -1222,13 +1222,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } } else { if ($this->preCalculateFormulas) { - $cellData = PHPExcel_Style_NumberFormat::toFormattedString( + $cellData = \PHPExcel\Style\NumberFormat::toFormattedString( $cell->getCalculatedValue(), $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), array($this, 'formatColor') ); } else { - $cellData = PHPExcel_Style_NumberFormat::toFormattedString( + $cellData = \PHPExcel\Style\NumberFormat::toFormattedString( $cell->getValue(), $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), array($this, 'formatColor') @@ -1266,7 +1266,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // General horizontal alignment: Actual horizontal alignment depends on dataType $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex()); - if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL + if ($sharedStyle->getAlignment()->getHorizontal() == \PHPExcel\Style\Alignment::HORIZONTAL_GENERAL && isset($this->cssStyles['.' . $cell->getDataType()]['text-align'])) { $cssClass['text-align'] = $this->cssStyles['.' . $cell->getDataType()]['text-align']; } @@ -1361,7 +1361,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ // Return return $html; } else { - throw new PHPExcel_Writer_Exception("Invalid parameters passed."); + throw new \PHPExcel\Writer\Exception("Invalid parameters passed."); } } @@ -1569,7 +1569,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $this->spansAreCalculated = true; } - private function setMargins(PHPExcel_Worksheet $pSheet) + private function setMargins(\PHPExcel\Worksheet $pSheet) { $htmlPage = '@page { '; $htmlBody = 'body { '; diff --git a/src/PhpSpreadsheet/Writer/IWriter.php b/src/PhpSpreadsheet/Writer/IWriter.php index 3a72bdae..fc4a5954 100644 --- a/src/PhpSpreadsheet/Writer/IWriter.php +++ b/src/PhpSpreadsheet/Writer/IWriter.php @@ -33,7 +33,7 @@ interface IWriter * Save PHPExcel to file * * @param string $pFilename Name of the file to save - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null); } diff --git a/src/PhpSpreadsheet/Writer/OpenDocument.php b/src/PhpSpreadsheet/Writer/OpenDocument.php index 912ba9df..7b2e04f3 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument.php @@ -44,9 +44,9 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P /** * Create a new PHPExcel_Writer_OpenDocument * - * @param PHPExcel $pPHPExcel + * @param \PHPExcel\SpreadSheet $pPHPExcel */ - public function __construct(PHPExcel $pPHPExcel = null) + public function __construct(\PHPExcel\SpreadSheet $pPHPExcel = null) { $this->setPHPExcel($pPHPExcel); @@ -69,7 +69,7 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P * Get writer part * * @param string $pPartName Writer part name - * @return PHPExcel_Writer_Excel2007_WriterPart + * @return \PHPExcel\Writer\Excel2007\WriterPart */ public function getWriterPart($pPartName = '') { @@ -84,12 +84,12 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P * Save PHPExcel to file * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { if (!$this->spreadSheet) { - throw new PHPExcel_Writer_Exception('PHPExcel object unassigned.'); + throw new \PHPExcel\Writer\Exception('PHPExcel object unassigned.'); } // garbage collect @@ -116,13 +116,13 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P // Close file if ($objZip->close() === false) { - throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename."); + throw new \PHPExcel\Writer\Exception("Could not close zip file $pFilename."); } // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new \PHPExcel\Writer\Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } @@ -132,13 +132,13 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P * Create zip object * * @param string $pFilename - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception * @return ZipArchive */ private function createZip($pFilename) { // Create new ZIP file and open it for writing - $zipClass = PHPExcel_Settings::getZipClass(); + $zipClass = \PHPExcel\Settings::getZipClass(); $objZip = new $zipClass(); // Retrieve OVERWRITE and CREATE constants from the instantiated zip class @@ -153,7 +153,7 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P // Try opening the ZIP file if ($objZip->open($pFilename, $zipOverWrite) !== true) { if ($objZip->open($pFilename, $zipCreate) !== true) { - throw new PHPExcel_Writer_Exception("Could not open $pFilename for writing."); + throw new \PHPExcel\Writer\Exception("Could not open $pFilename for writing."); } } @@ -164,14 +164,14 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P * Get PHPExcel object * * @return PHPExcel - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function getPHPExcel() { if ($this->spreadSheet !== null) { return $this->spreadSheet; } else { - throw new PHPExcel_Writer_Exception('No PHPExcel assigned.'); + throw new \PHPExcel\Writer\Exception('No PHPExcel assigned.'); } } @@ -179,10 +179,10 @@ class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements P * Set PHPExcel object * * @param PHPExcel $pPHPExcel PHPExcel object - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception * @return PHPExcel_Writer_Excel2007 */ - public function setPHPExcel(PHPExcel $pPHPExcel = null) + public function setPHPExcel(\PHPExcel\SpreadSheet $pPHPExcel = null) { $this->spreadSheet = $pPHPExcel; return $this; diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php index a34b1670..b2991673 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Content.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Content.php @@ -44,9 +44,9 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_ * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function write(PHPExcel $pPHPExcel = null) + public function write(\PHPExcel\SpreadSheet $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); /* @var $pPHPExcel PHPExcel */ @@ -141,9 +141,9 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_ * Write rows of the specified sheet * * @param PHPExcel_Shared_XMLWriter $objWriter - * @param PHPExcel_Worksheet $sheet + * @param \PHPExcel\Worksheet $sheet */ - private function writeRows(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet $sheet) + private function writeRows(PHPExcel_Shared_XMLWriter $objWriter, \PHPExcel\Worksheet $sheet) { $number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX; $span_row = 0; @@ -177,10 +177,10 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_ * Write cells of the specified row * * @param PHPExcel_Shared_XMLWriter $objWriter - * @param PHPExcel_Worksheet_Row $row - * @throws PHPExcel_Writer_Exception + * @param \PHPExcel\Worksheet\Row $row + * @throws \PHPExcel\Writer\Exception */ - private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row) + private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, \PHPExcel\Worksheet\Row $row) { $number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX; $prev_column = -1; @@ -193,17 +193,17 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_ $objWriter->startElement('table:table-cell'); switch ($cell->getDataType()) { - case PHPExcel_Cell_DataType::TYPE_BOOL: + case \PHPExcel\Cell\DataType::TYPE_BOOL: $objWriter->writeAttribute('office:value-type', 'boolean'); $objWriter->writeAttribute('office:value', $cell->getValue()); $objWriter->writeElement('text:p', $cell->getValue()); break; - case PHPExcel_Cell_DataType::TYPE_ERROR: - throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.'); + case \PHPExcel\Cell\DataType::TYPE_ERROR: + throw new \PHPExcel\Writer\Exception('Writing of error not implemented yet.'); break; - case PHPExcel_Cell_DataType::TYPE_FORMULA: + case \PHPExcel\Cell\DataType::TYPE_FORMULA: try { $formula_value = $cell->getCalculatedValue(); } catch (Exception $e) { @@ -219,17 +219,17 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_ $objWriter->writeElement('text:p', $formula_value); break; - case PHPExcel_Cell_DataType::TYPE_INLINE: - throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.'); + case \PHPExcel\Cell\DataType::TYPE_INLINE: + throw new \PHPExcel\Writer\Exception('Writing of inline not implemented yet.'); break; - case PHPExcel_Cell_DataType::TYPE_NUMERIC: + case \PHPExcel\Cell\DataType::TYPE_NUMERIC: $objWriter->writeAttribute('office:value-type', 'float'); $objWriter->writeAttribute('office:value', $cell->getValue()); $objWriter->writeElement('text:p', $cell->getValue()); break; - case PHPExcel_Cell_DataType::TYPE_STRING: + case \PHPExcel\Cell\DataType::TYPE_STRING: $objWriter->writeAttribute('office:value-type', 'string'); $objWriter->writeElement('text:p', $cell->getValue()); break; diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php index 1a5c5fd0..51f07c97 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Meta.php @@ -32,9 +32,9 @@ class PHPExcel_Writer_OpenDocument_Meta extends PHPExcel_Writer_OpenDocument_Wri * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function write(PHPExcel $pPHPExcel = null) + public function write(\PHPExcel\SpreadSheet $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); @@ -80,7 +80,7 @@ class PHPExcel_Writer_OpenDocument_Meta extends PHPExcel_Writer_OpenDocument_Wri $objWriter->writeAttribute('meta:name', 'Company'); $objWriter->writeRaw($pPHPExcel->getProperties()->getCompany()); $objWriter->endElement(); - + $objWriter->startElement('meta:user-defined'); $objWriter->writeAttribute('meta:name', 'category'); $objWriter->writeRaw($pPHPExcel->getProperties()->getCategory()); diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/MetaInf.php b/src/PhpSpreadsheet/Writer/OpenDocument/MetaInf.php index c43b7233..652a6bc8 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/MetaInf.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/MetaInf.php @@ -30,11 +30,11 @@ class PHPExcel_Writer_OpenDocument_MetaInf extends PHPExcel_Writer_OpenDocument_ /** * Write META-INF/manifest.xml to XML format * - * @param PHPExcel $pPHPExcel + * @param \PHPExcel\SpreadSheet $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeManifest(PHPExcel $pPHPExcel = null) + public function writeManifest(\PHPExcel\SpreadSheet $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Mimetype.php b/src/PhpSpreadsheet/Writer/OpenDocument/Mimetype.php index d51a8b97..783db493 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Mimetype.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Mimetype.php @@ -30,11 +30,11 @@ class PHPExcel_Writer_OpenDocument_Mimetype extends PHPExcel_Writer_OpenDocument /** * Write mimetype to plain text format * - * @param PHPExcel $pPHPExcel + * @param \PHPExcel\SpreadSheet $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function write(PHPExcel $pPHPExcel = null) + public function write(\PHPExcel\SpreadSheet $pPHPExcel = null) { return 'application/vnd.oasis.opendocument.spreadsheet'; } diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Settings.php b/src/PhpSpreadsheet/Writer/OpenDocument/Settings.php index 84161b6d..7a22186c 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Settings.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Settings.php @@ -32,9 +32,9 @@ class PHPExcel_Writer_OpenDocument_Settings extends PHPExcel_Writer_OpenDocument * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function write(PHPExcel $pPHPExcel = null) + public function write(\PHPExcel\SpreadSheet $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Styles.php b/src/PhpSpreadsheet/Writer/OpenDocument/Styles.php index cc6e25b4..76d120dd 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Styles.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Styles.php @@ -32,9 +32,9 @@ class PHPExcel_Writer_OpenDocument_Styles extends PHPExcel_Writer_OpenDocument_W * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function write(PHPExcel $pPHPExcel = null) + public function write(\PHPExcel\SpreadSheet $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/Thumbnails.php b/src/PhpSpreadsheet/Writer/OpenDocument/Thumbnails.php index 54247ae2..b59c37d4 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/Thumbnails.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/Thumbnails.php @@ -32,9 +32,9 @@ class PHPExcel_Writer_OpenDocument_Thumbnails extends PHPExcel_Writer_OpenDocume * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ - public function writeThumbnail(PHPExcel $pPHPExcel = null) + public function writeThumbnail(\PHPExcel\SpreadSheet $pPHPExcel = null) { return ''; } diff --git a/src/PhpSpreadsheet/Writer/OpenDocument/WriterPart.php b/src/PhpSpreadsheet/Writer/OpenDocument/WriterPart.php index 562787a3..d1e2ac48 100644 --- a/src/PhpSpreadsheet/Writer/OpenDocument/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/OpenDocument/WriterPart.php @@ -25,6 +25,6 @@ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ -abstract class PHPExcel_Writer_OpenDocument_WriterPart extends PHPExcel_Writer_Excel2007_WriterPart +abstract class PHPExcel_Writer_OpenDocument_WriterPart extends \PHPExcel\Writer\Excel2007\WriterPart { } diff --git a/src/PhpSpreadsheet/Writer/PDF/Core.php b/src/PhpSpreadsheet/Writer/PDF/Core.php index 5a96bcf1..9dceffda 100644 --- a/src/PhpSpreadsheet/Writer/PDF/Core.php +++ b/src/PhpSpreadsheet/Writer/PDF/Core.php @@ -71,137 +71,137 @@ abstract class Core extends \PHPExcel\Writer\HTML * @var array */ protected static $paperSizes = array( - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_TABLOID => array(792.00, 1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LEDGER => array(1224.00, 792.00), // (17 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STATEMENT => array(396.00, 612.00), // (5.5 in. by 8.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_QUARTO => array(609.45, 779.53), // (215 mm by 275 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STANDARD_1 => array(720.00, 1008.00), // (10 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STANDARD_2 => array(792.00, 1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NO9_ENVELOPE => array(279.00, 639.00), // (3.875 in. by 8.875 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NO10_ENVELOPE => array(297.00, 684.00), // (4.125 in. by 9.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NO11_ENVELOPE => array(324.00, 747.00), // (4.5 in. by 10.375 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NO12_ENVELOPE => array(342.00, 792.00), // (4.75 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_NO14_ENVELOPE => array(360.00, 828.00), // (5 in. by 11.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C => array(1224.00, 1584.00), // (17 in. by 22 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_D + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_D => array(1584.00, 2448.00), // (22 in. by 34 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_E + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_E => array(2448.00, 3168.00), // (34 in. by 44 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_DL_ENVELOPE => array(311.81, 623.62), // (110 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_C65_ENVELOPE => array(323.15, 649.13), // (114 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_B6_ENVELOPE => array(498.90, 354.33), // (176 mm by 125 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_ITALY_ENVELOPE => array(311.81, 651.97), // (110 mm by 230 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_MONARCH_ENVELOPE => array(279.00, 540.00), // (3.875 in. by 7.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_6_3_4_ENVELOPE => array(261.00, 468.00), // (3.625 in. by 6.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => array(1071.00, 792.00), // (14.875 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => array(612.00, 864.00), // (8.5 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => array(566.93, 419.53), // (200 mm by 148 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_1 => array(648.00, 792.00), // (9 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_2 => array(720.00, 792.00), // (10 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_3 => array(1080.00, 792.00), // (15 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_INVITE_ENVELOPE => array(623.62, 623.62), // (220 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => array(667.80, 864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => array(667.80, 1080.00), // (9.275 in. by 15 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => array(841.68, 1296.00), // (11.69 in. by 18 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4_EXTRA_PAPER => array(668.98, 912.76), // (236 mm by 322 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => array(595.80, 792.00), // (8.275 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => array(667.80, 864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => array(643.46, 1009.13), // (227 mm by 356 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => array(864.57, 1380.47), // (305 mm by 487 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => array(612.00, 913.68), // (8.5 in. by 12.69 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4_PLUS_PAPER => array(595.28, 935.43), // (210 mm by 330 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => array(515.91, 728.50), // (182 mm by 257 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_PAPER => array(912.76, 1261.42), // (322 mm by 445 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A5_EXTRA_PAPER => array(493.23, 666.14), // (174 mm by 235 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => array(569.76, 782.36), // (201 mm by 276 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER + \PHPExcel\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => array(912.76, 1261.42) // (322 mm by 445 mm) ); @@ -258,7 +258,7 @@ abstract class Core extends \PHPExcel\Writer\HTML * @param string $pValue Paper size * @return PHPExcel_Writer_PDF */ - public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) + public function setPaperSize($pValue = \PHPExcel\Worksheet\PageSetup::PAPERSIZE_LETTER) { $this->paperSize = $pValue; return $this; @@ -280,7 +280,7 @@ abstract class Core extends \PHPExcel\Writer\HTML * @param string $pValue Page orientation * @return PHPExcel_Writer_PDF */ - public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) + public function setOrientation($pValue = \PHPExcel\Worksheet\PageSetup::ORIENTATION_DEFAULT) { $this->orientation = $pValue; return $this; @@ -300,7 +300,7 @@ abstract class Core extends \PHPExcel\Writer\HTML * Set temporary storage directory * * @param string $pValue Temporary storage directory - * @throws PHPExcel_Writer_Exception when directory does not exist + * @throws \PHPExcel\Writer\Exception when directory does not exist * @return PHPExcel_Writer_PDF */ public function setTempDir($pValue = '') @@ -308,7 +308,7 @@ abstract class Core extends \PHPExcel\Writer\HTML if (is_dir($pValue)) { $this->tempDir = $pValue; } else { - throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); + throw new \PHPExcel\Writer\Exception("Directory does not exist: $pValue"); } return $this; } @@ -317,7 +317,7 @@ abstract class Core extends \PHPExcel\Writer\HTML * Save Spreadsheet to PDF file, pre-save * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ protected function prepareForSave($pFilename = null) { @@ -330,7 +330,7 @@ abstract class Core extends \PHPExcel\Writer\HTML // Open file $fileHandle = fopen($pFilename, 'w'); if ($fileHandle === false) { - throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + throw new \PHPExcel\Writer\Exception("Could not open file $pFilename for writing."); } // Set PDF @@ -345,7 +345,7 @@ abstract class Core extends \PHPExcel\Writer\HTML * Save PHPExcel to PDF file, post-save * * @param resource $fileHandle - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ protected function restoreStateAfterSave($fileHandle) { diff --git a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php index fffde763..38df0c61 100644 --- a/src/PhpSpreadsheet/Writer/PDF/DomPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/DomPDF.php @@ -63,22 +63,22 @@ class DomPDF extends Core implements \PHPExcel\Writer\IWriter // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); } - + $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) - ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + $orientation = ($this->getOrientation() == \PHPExcel\Worksheet\PageSetup::ORIENTATION_DEFAULT) + ? \PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); } // Override Paper Size diff --git a/src/PhpSpreadsheet/Writer/PDF/mPDF.php b/src/PhpSpreadsheet/Writer/PDF/mPDF.php index 7ae5570b..42768e45 100644 --- a/src/PhpSpreadsheet/Writer/PDF/mPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/mPDF.php @@ -51,7 +51,7 @@ class mPDF extends Core implements \PHPExcel\Writer\IWriter * Save Spreadsheet to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { @@ -63,12 +63,12 @@ class mPDF extends Core implements \PHPExcel\Writer\IWriter // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); } @@ -76,8 +76,8 @@ class mPDF extends Core implements \PHPExcel\Writer\IWriter // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) - ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + $orientation = ($this->getOrientation() == \PHPExcel\Worksheet\PageSetup::ORIENTATION_DEFAULT) + ? \PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); } $orientation = strtoupper($orientation); diff --git a/src/PhpSpreadsheet/Writer/PDF/tcPDF.php b/src/PhpSpreadsheet/Writer/PDF/tcPDF.php index 854cf1d7..f77690b8 100644 --- a/src/PhpSpreadsheet/Writer/PDF/tcPDF.php +++ b/src/PhpSpreadsheet/Writer/PDF/tcPDF.php @@ -52,7 +52,7 @@ class tcPDF extends Core implements \PHPExcel\Writer\IWriter * Save Spreadsheet to file * * @param string $pFilename Name of the file to save as - * @throws PHPExcel_Writer_Exception + * @throws \PHPExcel\Writer\Exception */ public function save($pFilename = null) { @@ -64,19 +64,19 @@ class tcPDF extends Core implements \PHPExcel\Writer\IWriter // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet(0)->getPageMargins(); } else { $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() - == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); } // Override Page Orientation if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + $orientation = ($this->getOrientation() == \PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; }