optimize for large exports
This commit is contained in:
parent
8e87c392a5
commit
c6b2498091
@ -103,10 +103,15 @@ class WriterEntityFactory
|
|||||||
public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null)
|
public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null)
|
||||||
{
|
{
|
||||||
$format = $rowStyle?->getFormat();
|
$format = $rowStyle?->getFormat();
|
||||||
|
$cellStyles = [];
|
||||||
|
|
||||||
$cells = \array_map(function ($k, $cellValue) {
|
if (is_array($format)) {
|
||||||
$cellStyle = (new StyleBuilder())->setFormat($format[$k] ?? '@')->build();
|
foreach ($format as $k => $f)
|
||||||
return new Cell($cellValue, $cellStyle);
|
$cellStyles[$k] = (new StyleBuilder())->setFormat($f ?? '@')->build();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cells = \array_map(function ($k, $cellValue) use ($cellStyles) {
|
||||||
|
return new Cell($cellValue, $cellStyles[$k] ?? null);
|
||||||
}, array_keys($cellValues), $cellValues);
|
}, array_keys($cellValues), $cellValues);
|
||||||
|
|
||||||
return new Row($cells, $rowStyle);
|
return new Row($cells, $rowStyle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user