From cdbeceba47e9a9694f3bad053e7c47b97773c28b Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 25 Nov 2011 12:16:01 +0000 Subject: [PATCH] Bugfix: Work item 16895 - PHP Invalid index notice on writing excel file when active sheet has been deleted General: Work item 16923 - Datatype.php & constant TYPE_NULL git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@83260 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel.php | 6 ++++++ Classes/PHPExcel/Cell/DataType.php | 2 +- Classes/PHPExcel/Reader/CSV.php | 2 +- Classes/PHPExcel/Reader/Excel2003XML.php | 2 +- Classes/PHPExcel/Writer/Excel5/Worksheet.php | 1 + .../Functionality Cross-Reference.xls | Bin 37376 -> 37376 bytes changelog.txt | 2 ++ 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel.php index bc85208..df111d4 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel.php @@ -244,6 +244,12 @@ class PHPExcel } else { array_splice($this->_workSheetCollection, $pIndex, 1); } + // Adjust active sheet index if necessary + if (($this->_activeSheetIndex >= $pIndex) && + ($pIndex > count($this->_workSheetCollection) - 1)) { + --$this->_activeSheetIndex; + } + } /** diff --git a/Classes/PHPExcel/Cell/DataType.php b/Classes/PHPExcel/Cell/DataType.php index 775d99d..e2410b3 100644 --- a/Classes/PHPExcel/Cell/DataType.php +++ b/Classes/PHPExcel/Cell/DataType.php @@ -41,7 +41,7 @@ class PHPExcel_Cell_DataType const TYPE_FORMULA = 'f'; const TYPE_NUMERIC = 'n'; const TYPE_BOOL = 'b'; - const TYPE_NULL = 's'; + const TYPE_NULL = 'null'; const TYPE_INLINE = 'inlineStr'; const TYPE_ERROR = 'e'; diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index ee342ac..dfc0280 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -217,7 +217,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader } $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); - $lineEnding = ini_set('auto_detect_line_endings'); + $lineEnding = ini_get('auto_detect_line_endings'); ini_set('auto_detect_line_endings', true); // Open file diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index 6e437de..608bfe2 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -651,7 +651,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader const TYPE_FORMULA = 'f'; const TYPE_NUMERIC = 'n'; const TYPE_BOOL = 'b'; - const TYPE_NULL = 's'; + const TYPE_NULL = 'null'; const TYPE_INLINE = 'inlineStr'; const TYPE_ERROR = 'e'; */ diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index 8efe315..baa72a4 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -410,6 +410,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } else { switch ($cell->getDatatype()) { case PHPExcel_Cell_DataType::TYPE_STRING: + case PHPExcel_Cell_DataType::TYPE_NULL: if ($cVal === '' || $cVal === null) { $this->_writeBlank($row, $column, $xfIndex); } else { diff --git a/Documentation/Functionality Cross-Reference.xls b/Documentation/Functionality Cross-Reference.xls index e25107a2fcbf372fc57f2bb063408016097c7024..c70fa93735747123f663bea50c545267981e0766 100644 GIT binary patch delta 30 mcmZoz!ql*YX@dq6Bg