Performance Experiment for the String Table, to avoid creating empty cells; should also be slightly faster

This commit is contained in:
MarkBaker 2022-05-05 10:05:32 +02:00
parent d686a991db
commit 5ae74145de
1 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\RichText\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\RichText\Run;
@ -35,8 +36,9 @@ class StringTable extends WriterPart
$aFlippedStringTable = $this->flipStringTable($aStringTable); $aFlippedStringTable = $this->flipStringTable($aStringTable);
// Loop through cells // Loop through cells
foreach ($worksheet->getCoordinates() as $coordinate) { foreach ($worksheet->getCellCollection()->getCoordinates() as $coordinate) {
$cell = $worksheet->getCell($coordinate); /** @var Cell $cell */
$cell = $worksheet->getCellCollection()->get($coordinate);
$cellValue = $cell->getValue(); $cellValue = $cell->getValue();
if ( if (
!is_object($cellValue) && !is_object($cellValue) &&