Performance Experiment for the Xls Writer, to avoid creating empty cells; and should also be slightly faster
This commit is contained in:
parent
b399c09dd5
commit
1b71e75bc2
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText\Run;
|
use PhpOffice\PhpSpreadsheet\RichText\Run;
|
||||||
|
|
@ -161,8 +162,9 @@ class Xls extends BaseWriter
|
||||||
|
|
||||||
// add fonts from rich text eleemnts
|
// add fonts from rich text eleemnts
|
||||||
for ($i = 0; $i < $countSheets; ++$i) {
|
for ($i = 0; $i < $countSheets; ++$i) {
|
||||||
foreach ($this->writerWorksheets[$i]->phpSheet->getCoordinates() as $coordinate) {
|
foreach ($this->writerWorksheets[$i]->phpSheet->getCellCollection()->getCoordinates() as $coordinate) {
|
||||||
$cell = $this->writerWorksheets[$i]->phpSheet->getCell($coordinate);
|
/** @var Cell $cell */
|
||||||
|
$cell = $this->writerWorksheets[$i]->phpSheet->getCellCollection()->get($coordinate);
|
||||||
$cVal = $cell->getValue();
|
$cVal = $cell->getValue();
|
||||||
if ($cVal instanceof RichText) {
|
if ($cVal instanceof RichText) {
|
||||||
$elements = $cVal->getRichTextElements();
|
$elements = $cVal->getRichTextElements();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
|
||||||
|
|
||||||
use GdImage;
|
use GdImage;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
||||||
|
|
@ -406,8 +407,9 @@ class Worksheet extends BIFFwriter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Cells
|
// Write Cells
|
||||||
foreach ($phpSheet->getCoordinates() as $coordinate) {
|
foreach ($phpSheet->getCellCollection()->getSortedCoordinates() as $coordinate) {
|
||||||
$cell = $phpSheet->getCell($coordinate);
|
/** @var Cell $cell */
|
||||||
|
$cell = $phpSheet->getCellCollection()->get($coordinate);
|
||||||
$row = $cell->getRow() - 1;
|
$row = $cell->getRow() - 1;
|
||||||
$column = Coordinate::columnIndexFromString($cell->getColumn()) - 1;
|
$column = Coordinate::columnIndexFromString($cell->getColumn()) - 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -36,6 +37,7 @@ class StringTable extends WriterPart
|
||||||
|
|
||||||
// Loop through cells
|
// Loop through cells
|
||||||
foreach ($worksheet->getCellCollection()->getCoordinates() as $coordinate) {
|
foreach ($worksheet->getCellCollection()->getCoordinates() as $coordinate) {
|
||||||
|
/** @var Cell $cell */
|
||||||
$cell = $worksheet->getCellCollection()->get($coordinate);
|
$cell = $worksheet->getCellCollection()->get($coordinate);
|
||||||
$cellValue = $cell->getValue();
|
$cellValue = $cell->getValue();
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue