From a88adcaf36e459b229739d6c32543558ca282df8 Mon Sep 17 00:00:00 2001 From: willkensonh Date: Mon, 15 Oct 2018 14:36:09 +1100 Subject: [PATCH] hopefullythelastone --- src/Spout/Common/Entity/Style/NumberFormat.php | 18 ------------------ .../Writer/XLSX/Manager/Style/StyleManager.php | 3 ++- .../XLSX/Manager/Style/StyleRegistry.php | 4 +--- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Spout/Common/Entity/Style/NumberFormat.php b/src/Spout/Common/Entity/Style/NumberFormat.php index a82fb11..2d9226e 100644 --- a/src/Spout/Common/Entity/Style/NumberFormat.php +++ b/src/Spout/Common/Entity/Style/NumberFormat.php @@ -36,16 +36,6 @@ class NumberFormat } } - /** - * @param int $id - * @return NumberFormat - */ - public function setId($id) - { - $this->id = $id; - return $this; - } - /** * @param bool $commas * @return NumberFormat @@ -56,14 +46,6 @@ class NumberFormat return $this; } - /** - * @return int|null - */ - public function getId() - { - return $this->id; - } - /** * @param int $type * @return NumberFormat diff --git a/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php b/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php index 5a50476..6de247b 100644 --- a/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php +++ b/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php @@ -75,7 +75,8 @@ EOD; foreach ($registeredFormats as $styleId) { $style = $this->styleRegistry->getStyleFromStyleId($styleId); $format = $style->getNumberFormat(); - $content .= ''; + $formatId = $this->styleRegistry->getNumberFormatIdForStyleId($styleId); + $content .= ''; } $content .= ''; diff --git a/src/Spout/Writer/XLSX/Manager/Style/StyleRegistry.php b/src/Spout/Writer/XLSX/Manager/Style/StyleRegistry.php index 4bf1d82..66a13d6 100644 --- a/src/Spout/Writer/XLSX/Manager/Style/StyleRegistry.php +++ b/src/Spout/Writer/XLSX/Manager/Style/StyleRegistry.php @@ -121,10 +121,8 @@ class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry $registeredFormatId = $this->styleIdToNumberFormatMappingTable[$registeredStyleId]; $this->styleIdToNumberFormatMappingTable[$styleId] = $registeredFormatId; } else { - $formatId = count($this->registeredNumberFormats); $this->registeredNumberFormats[$serializedFormat] = $styleId; - $this->styleIdToNumberFormatMappingTable[$styleId] = $formatId; - $format->setId($formatId); + $this->styleIdToNumberFormatMappingTable[$styleId] = count($this->registeredNumberFormats); } } else { // The fillId maps a style to a fill declaration