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
This commit is contained in:
Mark Baker 2011-01-07 14:52:28 +00:00
parent 1c6fa7b5ab
commit 1ec263ee94
2 changed files with 17 additions and 18 deletions

View File

@ -59,24 +59,22 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// Fill index array // Fill index array
$aFlippedStringTable = $this->flipStringTable($aStringTable); $aFlippedStringTable = $this->flipStringTable($aStringTable);
// Loop through cells // Loop through cells
foreach ($pSheet->getCellCollection() as $cellID) { foreach ($pSheet->getCellCollection() as $cellID) {
$cell = $pSheet->getCell($cellID); $cell = $pSheet->getCell($cellID);
if (!is_object($cell->getValue()) && $cellValue = $cell->getValue();
!isset($aFlippedStringTable[$cell->getValue()]) && if (!is_object($cellValue) &&
!is_null($cell->getValue()) && !is_null($cellValue) &&
$cell->getValue() !== '' && $cellValue !== '' &&
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL) !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[] = $cell->getValue(); $aStringTable[] = $cellValue;
$aFlippedStringTable[$cell->getValue()] = 1; $aFlippedStringTable[$cellValue] = 1;
} elseif ($cellValue instanceof PHPExcel_RichText &&
} else if ($cell->getValue() instanceof PHPExcel_RichText && !is_null($cellValue) &&
!isset($aFlippedStringTable[$cell->getValue()->getHashCode()]) && !isset($aFlippedStringTable[$cellValue->getHashCode()])) {
!is_null($cell->getValue()) $aStringTable[] = $cellValue;
) { $aFlippedStringTable[$cellValue->getHashCode()] = 1;
$aStringTable[] = $cell->getValue();
$aFlippedStringTable[$cell->getValue()->getHashCode()] = 1;
} }
} }

View File

@ -39,6 +39,7 @@ Fixed in SVN:
- Bugfix: (MBaker) Work item 13215 - Formatting get lost and edit a template XLSX file - 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 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.