Skip to content

Commit eb9522d

Browse files
author
Jens Hassler
committed
quick & dirty fix for PhpSpreadsheet issue PHPOffice#1215 -- needs rework!
1 parent 9d6736d commit eb9522d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -3664,8 +3664,15 @@ private function _parseFormula($formula, Cell $pCell = null)
36643664
$val = $rangeWS2 . $endRowColRef . $val;
36653665
} elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
36663666
(strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
3667-
// Column range
3668-
$endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
3667+
// Column range
3668+
$refSheet = $pCellParent;
3669+
3670+
// see https://github.com/PHPOffice/PhpSpreadsheet/issues/1215
3671+
$rangeSheetName = \str_replace('!', '', $rangeWS1);
3672+
if ($rangeSheetName !== $pCellParent->getTitle()) {
3673+
$refSheet = $pCell->getWorksheet()->getParent()->getSheetByName($rangeSheetName);
3674+
}
3675+
$endRowColRef = ($pCellParent !== null) ? $refSheet->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
36693676
$output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1';
36703677
$val = $rangeWS2 . $val . $endRowColRef;
36713678
}

0 commit comments

Comments
 (0)