From 04764644f791924d7c74b4bf0b9bbd516b67bd9a Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 3 Sep 2010 17:34:53 +0000 Subject: [PATCH] Bugfix: Workitem 14146 - Worksheet clone broken for CachedObjectStorage_Memory Bugfix: Workitem 12998 - PHPExcel_Reader_Excel2007 fails when gradient fill without type is present in a file Bugfix: Workitem 14176 - @ format for numeric strings in XLSX to CSV conversion git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@60349 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/CachedObjectStorage/Memory.php | 13 +++++++++++++ Classes/PHPExcel/Reader/Excel2007.php | 4 +++- Classes/PHPExcel/Style/NumberFormat.php | 4 ++-- changelog.txt | 4 ++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel/CachedObjectStorage/Memory.php b/Classes/PHPExcel/CachedObjectStorage/Memory.php index 85950701..b3556382 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memory.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memory.php @@ -68,6 +68,19 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C } // function getCacheData() + public function copyCellCollection(PHPExcel_Worksheet $parent) { + parent::copyCellCollection($parent); + + $newCollection = array(); + foreach($this->_cellCache as $k => &$cell) { + $newCollection[$k] = clone $cell; + $newCollection[$k]->attach($parent); + } + + $this->_cellCache = $newCollection; + } + + public function unsetWorksheetCells() { // Because cells are all stored as intact objects in memory, we need to detach each one from the parent foreach($this->_cellCache as $k => &$cell) { diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index 61862183..79e9fbb4 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -1471,7 +1471,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (isset($style->fill)) { if ($style->fill->gradientFill) { $gradientFill = $style->fill->gradientFill[0]; - $docStyle->getFill()->setFillType((string) $gradientFill["type"]); + if(!empty($gradientFill["type"])) { + $docStyle->getFill()->setFillType((string) $gradientFill["type"]); + } $docStyle->getFill()->setRotation(floatval($gradientFill["degree"])); $gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $docStyle->getFill()->getStartColor()->setARGB($this->_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) ); diff --git a/Classes/PHPExcel/Style/NumberFormat.php b/Classes/PHPExcel/Style/NumberFormat.php index 7d3d6f37..679d0588 100644 --- a/Classes/PHPExcel/Style/NumberFormat.php +++ b/Classes/PHPExcel/Style/NumberFormat.php @@ -323,7 +323,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable self::$_builtInFormats = array(); // General - self::$_builtInFormats[0] = 'General'; + self::$_builtInFormats[0] = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; self::$_builtInFormats[1] = '0'; self::$_builtInFormats[2] = '0.00'; self::$_builtInFormats[3] = '#,##0'; @@ -509,7 +509,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, // it seems to round numbers to a total of 10 digits. - if ($format === 'General') { + if (($format === PHPExcel_Style_NumberFormat::FORMAT_GENERAL) || ($format === PHPExcel_Style_NumberFormat::FORMAT_TEXT)) { return $value; } diff --git a/changelog.txt b/changelog.txt index fa2f94c7..472fefac 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,6 +31,10 @@ Fixed in SVN: - Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Concatenation operator +- Bugfix: (MBaker) Workitem 14146 - Worksheet clone broken for CachedObjectStorage_Memory +- Bugfix: (MBaker) Workitem 12998 - PHPExcel_Reader_Excel2007 fails when gradient fill without type is present in a file +- Bugfix: (MBaker) Workitem 14176 - @ format for numeric strings in XLSX to CSV conversion + 2010-08-26 (v1.7.4): - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Power