diff --git a/src/Spout/Writer/XLSX/Manager/OptionsManager.php b/src/Spout/Writer/XLSX/Manager/OptionsManager.php index 53718bc..0c08b5a 100644 --- a/src/Spout/Writer/XLSX/Manager/OptionsManager.php +++ b/src/Spout/Writer/XLSX/Manager/OptionsManager.php @@ -14,7 +14,7 @@ class OptionsManager extends OptionsManagerAbstract { /** Default style font values */ const DEFAULT_FONT_SIZE = 12; - const DEFAULT_FONT_NAME = 'Calibri'; + const DEFAULT_FONT_NAME = 'Arial'; /** @var StyleBuilder Style builder */ protected $styleBuilder; diff --git a/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php b/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php index 0a72ba9..4a608ba 100644 --- a/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php +++ b/src/Spout/Writer/XLSX/Manager/Style/StyleManager.php @@ -225,7 +225,7 @@ EOD; $styleId = $style->getId(); $fillId = $this->getFillIdForStyleId($styleId); $borderId = $this->getBorderIdForStyleId($styleId); - $numberFormatId = !empty($style->getNumberFormat()) ? $style->getNumberFormat()->getId() : 0; + $numberFormatId = $this->getNumberFormatIdForStyleId($styleId); $content .= 'styleRegistry->getBorderIdForStyleId($styleId) ?: 0); } + /** + * Returns the fill ID associated to the given style ID. + * For the default style, we don't a border. + * + * @param int $styleId + * @return int + */ + private function getNumberFormatIdForStyleId($styleId) + { + // For the default style (ID = 0), we don't want to override the border. + // Otherwise all cells of the spreadsheet will have a border. + $isDefaultStyle = ($styleId === 0); + + return $isDefaultStyle ? 0 : ($this->styleRegistry->getNumberFormatIdForStyleId($styleId) ?: 0); + } + /** * Returns the content of the "" section. *