From a376606bd24ecc31aeadeb0b673226cdc9b6a20d Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Tue, 4 Sep 2012 12:46:30 +0100 Subject: [PATCH] - Bugfix: Work item 18425 - Problems with $_activeSheetIndex when decreased below 0. --- Classes/PHPExcel.php | 7 +++++-- changelog.txt | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel.php index a78c5ce0..cc70286d 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel.php @@ -198,7 +198,7 @@ class PHPExcel * @return PHPExcel_Worksheet * @throws Exception */ - public function createSheet($iSheetIndex = null) + public function createSheet($iSheetIndex = NULL) { $newSheet = new PHPExcel_Worksheet($this); $this->addSheet($newSheet, $iSheetIndex); @@ -224,13 +224,16 @@ class PHPExcel * @return PHPExcel_Worksheet * @throws Exception */ - public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) + public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL) { if ($this->sheetNameExists($pSheet->getTitle())) { throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."); } if($iSheetIndex === NULL) { + if ($this->_activeSheetIndex < 0) { + $this->_activeSheetIndex = 0; + } $this->_workSheetCollection[] = $pSheet; } else { // Insert the sheet at the requested index diff --git a/changelog.txt b/changelog.txt index 193fba8b..2d4d439b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -108,6 +108,7 @@ Fixed in develop branch: - Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType - Bugfix: (dverspui) Pattern fill colours in Excel2007 Style Writer - Bugfix: (MBaker) Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack +- Bugfix: (MBaker) Work item 18425 - Problems with $_activeSheetIndex when decreased below 0. 2012-05-19 (v1.7.7):