Minor performance tweaks

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85743 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-01-25 23:07:22 +00:00
parent 2cce9b754d
commit 9c2ceed08d
16 changed files with 46 additions and 50 deletions

View File

@ -208,12 +208,9 @@ class PHPExcel
*/ */
public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null) public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
{ {
if(is_null($iSheetIndex)) if($iSheetIndex === NULL) {
{
$this->_workSheetCollection[] = $pSheet; $this->_workSheetCollection[] = $pSheet;
} } else {
else
{
// Insert the sheet at the requested index // Insert the sheet at the requested index
array_splice( array_splice(
$this->_workSheetCollection, $this->_workSheetCollection,
@ -226,7 +223,6 @@ class PHPExcel
if ($this->_activeSheetIndex >= $iSheetIndex) { if ($this->_activeSheetIndex >= $iSheetIndex) {
++$this->_activeSheetIndex; ++$this->_activeSheetIndex;
} }
} }
return $pSheet; return $pSheet;
} }
@ -417,7 +413,7 @@ class PHPExcel
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) { public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
if (!is_null($this->getSheetByName($pSheet->getTitle()))) { if ($this->getSheetByName($pSheet->getTitle()) !== NULL) {
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
} }
@ -477,14 +473,14 @@ class PHPExcel
public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
$returnValue = null; $returnValue = null;
if ($namedRange != '' && !is_null($namedRange)) { if ($namedRange != '' && ($namedRange !== NULL)) {
// first look for global defined name // first look for global defined name
if (isset($this->_namedRanges[$namedRange])) { if (isset($this->_namedRanges[$namedRange])) {
$returnValue = $this->_namedRanges[$namedRange]; $returnValue = $this->_namedRanges[$namedRange];
} }
// then look for local defined name (has priority over global defined name if both names exist) // then look for local defined name (has priority over global defined name if both names exist)
if (!is_null($pSheet) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
$returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]; $returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange];
} }
} }
@ -500,7 +496,7 @@ class PHPExcel
* @return PHPExcel * @return PHPExcel
*/ */
public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
if (is_null($pSheet)) { if ($pSheet === NULL) {
if (isset($this->_namedRanges[$namedRange])) { if (isset($this->_namedRanges[$namedRange])) {
unset($this->_namedRanges[$namedRange]); unset($this->_namedRanges[$namedRange]);
} }

View File

@ -221,7 +221,7 @@ class PHPExcel_CachedObjectStorage_CacheBase {
*/ */
public function copyCellCollection(PHPExcel_Worksheet $parent) { public function copyCellCollection(PHPExcel_Worksheet $parent) {
$this->_parent = $parent; $this->_parent = $parent;
if ((!is_null($this->_currentObject)) && (is_object($this->_currentObject))) { if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
$this->_currentObject->attach($parent); $this->_currentObject->attach($parent);
} }
} // function copyCellCollection() } // function copyCellCollection()

View File

@ -66,7 +66,7 @@ class PHPExcel_CachedObjectStorageFactory {
public static function getCacheStorageMethod() { public static function getCacheStorageMethod() {
if (!is_null(self::$_cacheStorageMethod)) { if (self::$_cacheStorageMethod !== NULL) {
return self::$_cacheStorageMethod; return self::$_cacheStorageMethod;
} }
return null; return null;
@ -74,7 +74,7 @@ class PHPExcel_CachedObjectStorageFactory {
public static function getCacheStorageClass() { public static function getCacheStorageClass() {
if (!is_null(self::$_cacheStorageClass)) { if (self::$_cacheStorageClass !== NULL) {
return self::$_cacheStorageClass; return self::$_cacheStorageClass;
} }
return null; return null;
@ -115,7 +115,7 @@ class PHPExcel_CachedObjectStorageFactory {
} }
} }
if (is_null(self::$_cacheStorageMethod)) { if (self::$_cacheStorageMethod === NULL) {
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
self::$_cacheStorageMethod = $method; self::$_cacheStorageMethod = $method;
} }
@ -125,13 +125,13 @@ class PHPExcel_CachedObjectStorageFactory {
public static function getInstance(PHPExcel_Worksheet $parent) { public static function getInstance(PHPExcel_Worksheet $parent) {
$cacheMethodIsAvailable = TRUE; $cacheMethodIsAvailable = TRUE;
if (is_null(self::$_cacheStorageMethod)) { if (self::$_cacheStorageMethod === NULL) {
$cacheMethodIsAvailable = self::initialize(); $cacheMethodIsAvailable = self::initialize();
} }
if ($cacheMethodIsAvailable) { if ($cacheMethodIsAvailable) {
$instance = new self::$_cacheStorageClass($parent,self::$_storageMethodParameters[self::$_cacheStorageMethod]); $instance = new self::$_cacheStorageClass($parent,self::$_storageMethodParameters[self::$_cacheStorageMethod]);
if (!is_null($instance)) { if ($instance !== NULL) {
return $instance; return $instance;
} }
} }

View File

@ -1710,7 +1710,7 @@ class PHPExcel_Calculation {
* @return PHPExcel_Calculation * @return PHPExcel_Calculation
*/ */
public static function getInstance() { public static function getInstance() {
if (!isset(self::$_instance) || is_null(self::$_instance)) { if (!isset(self::$_instance) || (self::$_instance === NULL)) {
self::$_instance = new PHPExcel_Calculation(); self::$_instance = new PHPExcel_Calculation();
} }
@ -1726,7 +1726,7 @@ class PHPExcel_Calculation {
* @return null * @return null
*/ */
public static function flushInstance() { public static function flushInstance() {
if (isset(self::$_instance) && !is_null(self::$_instance)) { if (isset(self::$_instance) && (self::$_instance !== NULL)) {
self::$_instance->clearCalculationCache(); self::$_instance->clearCalculationCache();
} }
} // function flushInstance() } // function flushInstance()
@ -2000,7 +2000,7 @@ class PHPExcel_Calculation {
private static $functionReplaceToLocale = null; private static $functionReplaceToLocale = null;
public function _translateFormulaToLocale($formula) { public function _translateFormulaToLocale($formula) {
if (is_null(self::$functionReplaceFromExcel)) { if (self::$functionReplaceFromExcel === NULL) {
self::$functionReplaceFromExcel = array(); self::$functionReplaceFromExcel = array();
foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) { foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
@ -2011,7 +2011,7 @@ class PHPExcel_Calculation {
} }
if (is_null(self::$functionReplaceToLocale)) { if (self::$functionReplaceToLocale === NULL) {
self::$functionReplaceToLocale = array(); self::$functionReplaceToLocale = array();
foreach(array_values(self::$_localeFunctions) as $localeFunctionName) { foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
@ -2029,7 +2029,7 @@ class PHPExcel_Calculation {
private static $functionReplaceToExcel = null; private static $functionReplaceToExcel = null;
public function _translateFormulaToEnglish($formula) { public function _translateFormulaToEnglish($formula) {
if (is_null(self::$functionReplaceFromLocale)) { if (self::$functionReplaceFromLocale === NULL) {
self::$functionReplaceFromLocale = array(); self::$functionReplaceFromLocale = array();
foreach(array_values(self::$_localeFunctions) as $localeFunctionName) { foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
@ -2039,7 +2039,7 @@ class PHPExcel_Calculation {
} }
} }
if (is_null(self::$functionReplaceToExcel)) { if (self::$functionReplaceToExcel === NULL) {
self::$functionReplaceToExcel = array(); self::$functionReplaceToExcel = array();
foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) { foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';

View File

@ -316,7 +316,7 @@ class PHPExcel_Cell
*/ */
public function setCalculatedValue($pValue = null) public function setCalculatedValue($pValue = null)
{ {
if (!is_null($pValue)) { if ($pValue !== NULL) {
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; $this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
} }

View File

@ -196,7 +196,7 @@ class PHPExcel_DocumentProperties
* @return PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties
*/ */
public function setCreated($pValue = null) { public function setCreated($pValue = null) {
if (is_null($pValue)) { if ($pValue === NULL) {
$pValue = time(); $pValue = time();
} elseif (is_string($pValue)) { } elseif (is_string($pValue)) {
if (is_numeric($pValue)) { if (is_numeric($pValue)) {
@ -226,7 +226,7 @@ class PHPExcel_DocumentProperties
* @return PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties
*/ */
public function setModified($pValue = null) { public function setModified($pValue = null) {
if (is_null($pValue)) { if ($pValue === NULL) {
$pValue = time(); $pValue = time();
} elseif (is_string($pValue)) { } elseif (is_string($pValue)) {
if (is_numeric($pValue)) { if (is_numeric($pValue)) {
@ -439,12 +439,12 @@ class PHPExcel_DocumentProperties
* @return PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties
*/ */
public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) { public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) {
if ((is_null($propertyType)) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER,
self::PROPERTY_TYPE_FLOAT, self::PROPERTY_TYPE_FLOAT,
self::PROPERTY_TYPE_STRING, self::PROPERTY_TYPE_STRING,
self::PROPERTY_TYPE_DATE, self::PROPERTY_TYPE_DATE,
self::PROPERTY_TYPE_BOOLEAN)))) { self::PROPERTY_TYPE_BOOLEAN)))) {
if (is_null($propertyValue)) { if ($propertyValue === NULL) {
$propertyType = self::PROPERTY_TYPE_STRING; $propertyType = self::PROPERTY_TYPE_STRING;
} elseif (is_float($propertyValue)) { } elseif (is_float($propertyValue)) {
$propertyType = self::PROPERTY_TYPE_FLOAT; $propertyType = self::PROPERTY_TYPE_FLOAT;

View File

@ -139,7 +139,7 @@ class PHPExcel_IOFactory
$classFile = str_replace('{0}', $writerType, $searchLocation['path']); $classFile = str_replace('{0}', $writerType, $searchLocation['path']);
$instance = new $className($phpExcel); $instance = new $className($phpExcel);
if (!is_null($instance)) { if ($instance !== NULL) {
return $instance; return $instance;
} }
} }
@ -169,7 +169,7 @@ class PHPExcel_IOFactory
$classFile = str_replace('{0}', $readerType, $searchLocation['path']); $classFile = str_replace('{0}', $readerType, $searchLocation['path']);
$instance = new $className(); $instance = new $className();
if (!is_null($instance)) { if ($instance !== NULL) {
return $instance; return $instance;
} }
} }

View File

@ -82,7 +82,7 @@ class PHPExcel_NamedRange
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{ {
// Validate data // Validate data
if (is_null($pName) || is_null($pWorksheet)|| is_null($pRange)) { if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
throw new Exception('Parameters can not be null.'); throw new Exception('Parameters can not be null.');
} }
@ -111,17 +111,17 @@ class PHPExcel_NamedRange
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setName($value = null) { public function setName($value = null) {
if (!is_null($value)) { if ($value !== NULL) {
// Old title // Old title
$oldTitle = $this->_name; $oldTitle = $this->_name;
// Re-attach // Re-attach
if (!is_null($this->_worksheet)) { if ($this->_worksheet !== NULL) {
$this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet);
} }
$this->_name = $value; $this->_name = $value;
if (!is_null($this->_worksheet)) { if ($this->_worksheet !== NULL) {
$this->_worksheet->getParent()->addNamedRange($this); $this->_worksheet->getParent()->addNamedRange($this);
} }
@ -148,7 +148,7 @@ class PHPExcel_NamedRange
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setWorksheet(PHPExcel_Worksheet $value = null) { public function setWorksheet(PHPExcel_Worksheet $value = null) {
if (!is_null($value)) { if ($value !== NULL) {
$this->_worksheet = $value; $this->_worksheet = $value;
} }
return $this; return $this;
@ -170,7 +170,7 @@ class PHPExcel_NamedRange
* @return PHPExcel_NamedRange * @return PHPExcel_NamedRange
*/ */
public function setRange($value = null) { public function setRange($value = null) {
if (!is_null($value)) { if ($value !== NULL) {
$this->_range = $value; $this->_range = $value;
} }
return $this; return $this;

View File

@ -500,7 +500,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
break; break;
} }
// echo 'Data value is '.$dataValue.'<br />'; // echo 'Data value is '.$dataValue.'<br />';
// if (!is_null($hyperlink)) { // if ($hyperlink !== NULL) {
// echo 'Hyperlink is '.$hyperlink.'<br />'; // echo 'Hyperlink is '.$hyperlink.'<br />';
// } // }
} }
@ -525,7 +525,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
// echo 'Adjusted Formula: '.$cellDataFormula.'<br />'; // echo 'Adjusted Formula: '.$cellDataFormula.'<br />';
} }
if (!is_null($type)) { if ($type !== NULL) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
// echo 'Forumla result is '.$dataValue.'<br />'; // echo 'Forumla result is '.$dataValue.'<br />';
@ -535,7 +535,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
($cellDataOfficeAttributes['value-type'] == 'time')) { ($cellDataOfficeAttributes['value-type'] == 'time')) {
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting); $objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting);
} }
if (!is_null($hyperlink)) { if ($hyperlink !== NULL) {
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink); $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink);
} }
} }

View File

@ -54,7 +54,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
$this->_richTextElements = array(); $this->_richTextElements = array();
// Rich-Text string attached to cell? // Rich-Text string attached to cell?
if (!is_null($pCell)) { if ($pCell !== NULL) {
// Add cell text and style // Add cell text and style
if ($pCell->getValue() != "") { if ($pCell->getValue() != "") {
$objRun = new PHPExcel_RichText_Run($pCell->getValue()); $objRun = new PHPExcel_RichText_Run($pCell->getValue());

View File

@ -80,7 +80,7 @@ class PHPExcel_Shared_File
} }
// Found something? // Found something?
if ($returnValue == '' || is_null($returnValue)) { if ($returnValue == '' || ($returnValue === NULL)) {
$pathArray = explode('/' , $pFilename); $pathArray = explode('/' , $pFilename);
while(in_array('..', $pathArray) && $pathArray[0] != '..') { while(in_array('..', $pathArray) && $pathArray[0] != '..') {
for ($i = 0; $i < count($pathArray); ++$i) { for ($i = 0; $i < count($pathArray); ++$i) {

View File

@ -79,7 +79,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
if (is_resource($filename)) { if (is_resource($filename)) {
$this->_FILEH_ = $filename; $this->_FILEH_ = $filename;
} else if ($filename == '-' || $filename == '') { } else if ($filename == '-' || $filename == '') {
if (is_null($this->_tmp_dir)) if ($this->_tmp_dir === NULL)
$this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
$this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b");

View File

@ -175,7 +175,7 @@ class PHPExcel_Shared_OLERead {
*/ */
public function getStream($stream) public function getStream($stream)
{ {
if (is_null($stream)) { if ($stream === NULL) {
return null; return null;
} }

View File

@ -65,7 +65,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter {
$this->openMemory(); $this->openMemory();
} else { } else {
// Create temporary filename // Create temporary filename
if (is_null($pTemporaryStorageFolder)) if ($pTemporaryStorageFolder === NULL)
$pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir(); $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');

View File

@ -1076,7 +1076,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
if (!is_null($namedRange)) { if ($namedRange !== NULL) {
$pCoordinate = $namedRange->getRange(); $pCoordinate = $namedRange->getRange();
if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
if (!$namedRange->getLocalOnly()) { if (!$namedRange->getLocalOnly()) {
@ -2278,7 +2278,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
*/ */
public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
$namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this);
if (!is_null($namedRange)) { if ($namedRange !== NULL) {
$pWorkSheet = $namedRange->getWorksheet(); $pWorkSheet = $namedRange->getWorksheet();
$pCellRange = $namedRange->getRange(); $pCellRange = $namedRange->getRange();
@ -2551,7 +2551,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
*/ */
public function getTabColor() public function getTabColor()
{ {
if (is_null($this->_tabColor)) if ($this->_tabColor === NULL)
$this->_tabColor = new PHPExcel_Style_Color(); $this->_tabColor = new PHPExcel_Style_Color();
return $this->_tabColor; return $this->_tabColor;
@ -2577,7 +2577,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
*/ */
public function isTabColorSet() public function isTabColorSet()
{ {
return !is_null($this->_tabColor); return ($this->_tabColor !== NULL);
} }
/** /**

View File

@ -45,7 +45,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
*/ */
public function createStringTable($pSheet = null, $pExistingTable = null) public function createStringTable($pSheet = null, $pExistingTable = null)
{ {
if (!is_null($pSheet)) { if ($pSheet !== NULL) {
// Create string lookup table // Create string lookup table
$aStringTable = array(); $aStringTable = array();
$cellCollection = null; $cellCollection = null;
@ -64,14 +64,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$cell = $pSheet->getCell($cellID); $cell = $pSheet->getCell($cellID);
$cellValue = $cell->getValue(); $cellValue = $cell->getValue();
if (!is_object($cellValue) && if (!is_object($cellValue) &&
!is_null($cellValue) && ($cellValue !== NULL) &&
$cellValue !== '' && $cellValue !== '' &&
!isset($aFlippedStringTable[$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; $aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue] = true; $aFlippedStringTable[$cellValue] = true;
} elseif ($cellValue instanceof PHPExcel_RichText && } elseif ($cellValue instanceof PHPExcel_RichText &&
!is_null($cellValue) && ($cellValue !== NULL) &&
!isset($aFlippedStringTable[$cellValue->getHashCode()])) { !isset($aFlippedStringTable[$cellValue->getHashCode()])) {
$aStringTable[] = $cellValue; $aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue->getHashCode()] = true; $aFlippedStringTable[$cellValue->getHashCode()] = true;