From 5979a4ec13436f18a2136f0c7b2f32b6acca541d Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 28 Apr 2011 20:42:50 +0000 Subject: [PATCH] Bugfix: Work item 15786 - RangeToArray strange array keys and Minor performance tweak to the workbook setActiveSheetIndexByName() method git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@72435 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel.php | 4 ++-- Classes/PHPExcel/Worksheet.php | 3 ++- changelog.txt | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel.php index 61ad667b..bc852080 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel.php @@ -379,7 +379,7 @@ class PHPExcel public function setActiveSheetIndexByName($pValue = '') { if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) { - $this->setActiveSheetIndex($worksheet->getParent()->getIndex($worksheet)); + $this->setActiveSheetIndex($this->getIndex($worksheet)); return $worksheet; } @@ -396,7 +396,7 @@ class PHPExcel $returnValue = array(); $worksheetCount = $this->getSheetCount(); for ($i = 0; $i < $worksheetCount; ++$i) { - array_push($returnValue, $this->getSheet($i)->getTitle()); + $returnValue[] = $this->getSheet($i)->getTitle(); } return $returnValue; diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 70ac3801..0d9bdefb 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -2176,11 +2176,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $maxCol++; // Loop through rows + $r = -1; for ($row = $minRow; $row <= $maxRow; ++$row) { + $rRef = ($returnCellRef) ? $row : ++$r; $c = -1; // Loop through columns in the current row for ($col = $minCol; $col != $maxCol; ++$col) { - $rRef = ($returnCellRef) ? $row : $row-1; $cRef = ($returnCellRef) ? $col : ++$c; // Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen // so we test and retrieve directly against _cellCollection diff --git a/changelog.txt b/changelog.txt index ad48976f..492d9abc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -31,6 +31,7 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug - Bugfix: (MBaker) Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula - Bugfix: (gilles06) Work item 15707 - ini_set() call in Calculation class destructor +- Bugfix: (MBaker) Work item 15786 - RangeToArray strange array keys - General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - General: (MBaker) Work item 15461 - Locale file paths not fit for windows