Merge pull request #2915 from PHPOffice/Performance-Refresh-Row/Column-Dimensions

Minor memory improvement
This commit is contained in:
Mark Baker 2022-06-30 17:18:37 +02:00 committed by GitHub
commit 5b74d1ffca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -316,6 +316,7 @@ class ReferenceHelper
$objColumnDimension->setColumnIndex($newReference);
}
}
$worksheet->refreshColumnDimensions();
}
}
@ -339,6 +340,7 @@ class ReferenceHelper
$objRowDimension->setRowIndex($newRoweference);
}
}
$worksheet->refreshRowDimensions();
$copyDimension = $worksheet->getRowDimension($beforeRow - 1);

View File

@ -658,10 +658,8 @@ class Worksheet implements IComparable
*/
public function refreshColumnDimensions()
{
$currentColumnDimensions = $this->getColumnDimensions();
$newColumnDimensions = [];
foreach ($currentColumnDimensions as $objColumnDimension) {
foreach ($this->getColumnDimensions() as $objColumnDimension) {
$newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension;
}
@ -677,10 +675,8 @@ class Worksheet implements IComparable
*/
public function refreshRowDimensions()
{
$currentRowDimensions = $this->getRowDimensions();
$newRowDimensions = [];
foreach ($currentRowDimensions as $objRowDimension) {
foreach ($this->getRowDimensions() as $objRowDimension) {
$newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension;
}