diff --git a/Classes/PHPExcel/ReferenceHelper.php b/Classes/PHPExcel/ReferenceHelper.php index 550b7f3f..e4aa9d8b 100644 --- a/Classes/PHPExcel/ReferenceHelper.php +++ b/Classes/PHPExcel/ReferenceHelper.php @@ -431,6 +431,7 @@ class PHPExcel_ReferenceHelper while ($cellID = array_pop($aCellCollection)) { $cell = $pSheet->getCell($cellID); $cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn()); + if ($cellIndex-1 + $pNumCols < 0) { continue; } @@ -736,6 +737,7 @@ class PHPExcel_ReferenceHelper } // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); + if ($matchCount > 0) { foreach($matches as $match) { $fromString = ($match[2] > '') ? $match[2].'!' : ''; @@ -750,7 +752,7 @@ class PHPExcel_ReferenceHelper // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; $row = trim($row,'$') + 10000000; - $cellIndex = $column.$row; + $cellIndex = $row . $column; $newCellTokens[$cellIndex] = preg_quote($toString); $cellTokens[$cellIndex] = '/(? 0) { - if ($pNumCols > 0) { - krsort($cellTokens); - krsort($newCellTokens); - } else { - ksort($cellTokens); - ksort($newCellTokens); - } + krsort($cellTokens); + krsort($newCellTokens); // Update cell references in the formula $formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock)); } diff --git a/changelog.txt b/changelog.txt index 052258f4..d213be5e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -39,6 +39,7 @@ Fixed in develop branch for release v1.8.0: - Bugfix: (IndrekHaav) Work Item CP16208 - Fixed undefined variable error due to $styleArray being used before it's initialised - Bugfix: (PowerKiKi) Work Item GH-273 - ISTEXT() return wrong result if referencing an empty but formatted cell - Bugfix: (PowerKiKi) Work Item GH-270/GH-31 - Binary comparison of strings are case insensitive +- Bugfix: (MBaker) Work Item GH-275 - Insert New Row/Column Before is not correctly updating formula references - Feature: (amerov) - Implementation of the Excel HLOOKUP() function - Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer