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

@ -62,21 +62,19 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// 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;
}
}

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 14029 - Excel 2007 Reader /writer lost fontcolor
- 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.