Merge fix to style duplication from the 1.x develop branch

This commit is contained in:
Mark Baker 2013-08-17 13:36:13 +01:00
parent 186302db5d
commit 4bd9df5c81
2 changed files with 17 additions and 17 deletions

View File

@ -424,7 +424,7 @@ class Style extends Style_Supervisor implements IComparable
$newStyle = clone $style;
$newStyle->applyFromArray($pStyles);
if ($workbook->cellXfExists($newStyle)) {
if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) {
// there is already such cell Xf in our collection
$newXfIndexes[$oldXfIndex] = $existingStyle->getIndex();
} else {

View File

@ -1478,9 +1478,9 @@ class Worksheet implements IComparable
// Add the style to the workbook if necessary
$workbook = $this->_parent;
if ($this->_parent->cellXfExists($pCellStyle)) {
// there is already this cell Xf in our collection
$xfIndex = $pCellStyle->getIndex();
if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) {
// there is already such cell Xf in our collection
$xfIndex = $existingStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($pCellStyle);