diff --git a/composer.json b/composer.json index 8bdd265..b3781a2 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": ">=7.3.0", + "php": ">=8.0", "ext-zip": "*", "ext-xmlreader": "*", "ext-dom": "*" diff --git a/src/Spout/Writer/Common/Creator/WriterEntityFactory.php b/src/Spout/Writer/Common/Creator/WriterEntityFactory.php index f07e5f0..e6333f9 100644 --- a/src/Spout/Writer/Common/Creator/WriterEntityFactory.php +++ b/src/Spout/Writer/Common/Creator/WriterEntityFactory.php @@ -7,6 +7,7 @@ use Box\Spout\Common\Entity\Row; use Box\Spout\Common\Entity\Style\Style; use Box\Spout\Common\Exception\UnsupportedTypeException; use Box\Spout\Common\Type; +use Box\Spout\Writer\Common\Creator\Style\StyleBuilder; use Box\Spout\Writer\WriterInterface; /** @@ -101,9 +102,12 @@ class WriterEntityFactory */ public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null) { - $cells = \array_map(function ($cellValue) { - return new Cell($cellValue); - }, $cellValues); + $format = $rowStyle?->getFormat(); + + $cells = \array_map(function ($k, $cellValue) { + $cellStyle = (new StyleBuilder())->setFormat($format[$k] ?? '@')->build(); + return new Cell($cellValue, $cellStyle); + }, array_keys($cellValues), $cellValues); return new Row($cells, $rowStyle); }