From 1ec263ee9473a1d8d546fa63da912682c3310c92 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 7 Jan 2011 14:52:28 +0000 Subject: [PATCH] General: Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@66590 2327b42d-5241-43d6-9e2a-de5ac946f064 --- .../PHPExcel/Writer/Excel2007/StringTable.php | 32 +++++++++---------- changelog.txt | 3 +- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Classes/PHPExcel/Writer/Excel2007/StringTable.php b/Classes/PHPExcel/Writer/Excel2007/StringTable.php index 2021bc18..2f2ff03b 100644 --- a/Classes/PHPExcel/Writer/Excel2007/StringTable.php +++ b/Classes/PHPExcel/Writer/Excel2007/StringTable.php @@ -59,24 +59,22 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Fill index array $aFlippedStringTable = $this->flipStringTable($aStringTable); - // Loop through cells - foreach ($pSheet->getCellCollection() as $cellID) { + // Loop through cells + foreach ($pSheet->getCellCollection() as $cellID) { $cell = $pSheet->getCell($cellID); - if (!is_object($cell->getValue()) && - !isset($aFlippedStringTable[$cell->getValue()]) && - !is_null($cell->getValue()) && - $cell->getValue() !== '' && - ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL) - ) { - $aStringTable[] = $cell->getValue(); - $aFlippedStringTable[$cell->getValue()] = 1; - - } else if ($cell->getValue() instanceof PHPExcel_RichText && - !isset($aFlippedStringTable[$cell->getValue()->getHashCode()]) && - !is_null($cell->getValue()) - ) { - $aStringTable[] = $cell->getValue(); - $aFlippedStringTable[$cell->getValue()->getHashCode()] = 1; + $cellValue = $cell->getValue(); + if (!is_object($cellValue) && + !is_null($cellValue) && + $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)) { + $aStringTable[] = $cellValue; + $aFlippedStringTable[$cellValue] = 1; + } elseif ($cellValue instanceof PHPExcel_RichText && + !is_null($cellValue) && + !isset($aFlippedStringTable[$cellValue->getHashCode()])) { + $aStringTable[] = $cellValue; + $aFlippedStringTable[$cellValue->getHashCode()] = 1; } } diff --git a/changelog.txt b/changelog.txt index c293a044..8bbc7606 100644 --- a/changelog.txt +++ b/changelog.txt @@ -38,7 +38,8 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 14999 - PHPExcel Excel2007 Reader colour problems with solidfill - Bugfix: (MBaker) Work item 13215 - Formatting get lost and edit a template XLSX file - Bugfix: (MBaker) Work item 14029 - Excel 2007 Reader /writer lost fontcolor -- Bugfix: (MBaker) Work item 13374 - file that makes cells go black +- Bugfix: (MBaker) Work item 13374 - file that makes cells go black +- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.