Skip to content

Commit

Permalink
quick & dirty fix for PhpSpreadsheet issue PHPOffice#1215 -- needs re…
Browse files Browse the repository at this point in the history
…work!
  • Loading branch information
Jens Hassler committed Oct 23, 2019
1 parent 9d6736d commit eb9522d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3664,8 +3664,15 @@ private function _parseFormula($formula, Cell $pCell = null)
$val = $rangeWS2 . $endRowColRef . $val;
} elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
(strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
// Column range
$endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
// Column range
$refSheet = $pCellParent;

// see https://github.com/PHPOffice/PhpSpreadsheet/issues/1215
$rangeSheetName = \str_replace('!', '', $rangeWS1);
if ($rangeSheetName !== $pCellParent->getTitle()) {
$refSheet = $pCell->getWorksheet()->getParent()->getSheetByName($rangeSheetName);
}
$endRowColRef = ($pCellParent !== null) ? $refSheet->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
$output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1';
$val = $rangeWS2 . $val . $endRowColRef;
}
Expand Down

0 comments on commit eb9522d

Please sign in to comment.