diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php
index d197efff..7ae0a992 100644
--- a/Classes/PHPExcel/Reader/Excel2007.php
+++ b/Classes/PHPExcel/Reader/Excel2007.php
@@ -262,36 +262,34 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
-// echo 'Formula
';
-// echo '$c->f is '.$c->f.'
';
+// echo 'Formula',PHP_EOL;
+// echo '$c->f is '.$c->f.PHP_EOL;
$cellDataType = 'f';
$value = "={$c->f}";
$calculatedValue = self::$castBaseType($c);
// Shared formula?
if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') {
-// echo 'SHARED FORMULA
';
+// echo 'SHARED FORMULA'.PHP_EOL;
$instance = (string)$c->f['si'];
-// echo 'Instance ID = '.$instance.'
';
+// echo 'Instance ID = '.$instance.PHP_EOL;
//
-// echo 'Shared Formula Array:
';
+// echo 'Shared Formula Array:'.PHP_EOL;
// print_r($sharedFormulas);
-// echo '
';
if (!isset($sharedFormulas[(string)$c->f['si']])) {
-// echo 'SETTING NEW SHARED FORMULA
';
-// echo 'Master is '.$r.'
';
-// echo 'Formula is '.$value.'
';
+// echo 'SETTING NEW SHARED FORMULA'.PHP_EOL;
+// echo 'Master is '.$r.PHP_EOL;
+// echo 'Formula is '.$value.PHP_EOL;
$sharedFormulas[$instance] = array( 'master' => $r,
'formula' => $value
);
-// echo 'New Shared Formula Array:';
+// echo 'New Shared Formula Array:'.PHP_EOL;
// print_r($sharedFormulas);
-// echo '
';
} else {
-// echo 'GETTING SHARED FORMULA
';
-// echo 'Master is '.$sharedFormulas[$instance]['master'].'
';
-// echo 'Formula is '.$sharedFormulas[$instance]['formula'].'
';
+// echo 'GETTING SHARED FORMULA'.PHP_EOL;
+// echo 'Master is '.$sharedFormulas[$instance]['master'].PHP_EOL;
+// echo 'Formula is '.$sharedFormulas[$instance]['formula'].PHP_EOL;
$master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
$current = PHPExcel_Cell::coordinateFromString($r);
@@ -304,7 +302,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$difference[0],
$difference[1]
);
-// echo 'Adjusted Formula is '.$value.'
';
+// echo 'Adjusted Formula is '.$value.PHP_EOL;
}
}
}
diff --git a/Classes/PHPExcel/ReferenceHelper.php b/Classes/PHPExcel/ReferenceHelper.php
index f7d13709..ff3ed2c4 100644
--- a/Classes/PHPExcel/ReferenceHelper.php
+++ b/Classes/PHPExcel/ReferenceHelper.php
@@ -702,7 +702,7 @@ class PHPExcel_ReferenceHelper
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
- $cellTokens[$cellIndex] = '/(? '') ? $match[2].'!' : '';
$fromString .= $match[3];
- $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
+ $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
if ($match[3] !== $modified3) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2].'!' : '';
@@ -753,7 +753,7 @@ class PHPExcel_ReferenceHelper
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
- $cellTokens[$cellIndex] = '/(?= PHPExcel_Cell::columnIndexFromString($beforeColumn));
-
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
$newRow >= $beforeRow);
diff --git a/changelog.txt b/changelog.txt
index 17242b7f..85874953 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -29,6 +29,8 @@ Fixed in develop branch for release v1.8.0:
- Bugfix: (MBaker) - Style error with merged cells in PDF Writer
- Bugfix: (MBaker) - Problem with cloning worksheets
- Bugfix: (tavoarcila) Work Item GH-259 - Bug fix reading Open Office files
+- Bugfix: (MBaker) Work item 20397 - Serious bug in absolute cell reference used in shared formula
+ Would also have affected insert/delete column/row
- 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