mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-13 03:26:26 +00:00
Update array formula ranges when inserting/deleting rows/columns
This commit is contained in:
@@ -424,6 +424,12 @@ class ReferenceHelper
|
||||
// Formula should be adjusted
|
||||
$worksheet->getCell($newCoordinate)
|
||||
->setValue($this->updateFormulaReferences($cell->getValue(), $beforeCellAddress, $numberOfColumns, $numberOfRows, $worksheet->getTitle()));
|
||||
if ($cell->arrayFormulaRange() !== null) {
|
||||
$newArrayFormulaRange = $this->updateFormulaReferences(
|
||||
$cell->arrayFormulaRange(), $beforeCellAddress, $numberOfColumns, $numberOfRows, $worksheet->getTitle()
|
||||
);
|
||||
$worksheet->getCell($newCoordinate)->setFormulaAttributes(['t' => 'array', 'ref' => $newArrayFormulaRange]);
|
||||
}
|
||||
} else {
|
||||
// Formula should not be adjusted
|
||||
$worksheet->getCell($newCoordinate)->setValueExplicit($cell->getValue(), $cell->getDataType());
|
||||
|
||||
Reference in New Issue
Block a user