diff --git a/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php b/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php index d6a5692..39854b1 100644 --- a/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php +++ b/src/Spout/Writer/Helper/XLSX/FileSystemHelper.php @@ -20,6 +20,7 @@ class FileSystemHelper extends \Box\Spout\Common\Helper\FileSystemHelper const XL_FOLDER_NAME = 'xl'; const WORKSHEETS_FOLDER_NAME = 'worksheets'; + const STYLES_FILE_NAME = 'styles.xml'; const RELS_FILE_NAME = '.rels'; const APP_XML_FILE_NAME = 'app.xml'; const CORE_XML_FILE_NAME = 'core.xml'; @@ -81,7 +82,8 @@ class FileSystemHelper extends \Box\Spout\Common\Helper\FileSystemHelper ->createRootFolder() ->createRelsFolderAndFile() ->createDocPropsFolderAndFiles() - ->createXlFolderAndSubFolders(); + ->createXlFolderAndSubFolders() + ->createStylesFile(); } /** @@ -234,6 +236,48 @@ EOD; return $this; } + /** + * Creates the "styles.xml" file under the "xl" folder + * + * @return FileSystemHelper + * @throws \Box\Spout\Common\Exception\IOException If unable to create the file + */ + protected function createStylesFile() + { + $stylesFileContents = << + + + + + + + + + + + + + + + + + + + + + + + + + +EOD; + + $this->createFileWithContents($this->xlFolder, self::STYLES_FILE_NAME, $stylesFileContents); + + return $this; + } + /** * Creates the "[Content_Types].xml" file under the root folder * @@ -248,6 +292,7 @@ EOD; + EOD; @@ -314,6 +359,7 @@ EOD; + EOD; diff --git a/src/Spout/Writer/Internal/XLSX/Worksheet.php b/src/Spout/Writer/Internal/XLSX/Worksheet.php index 8007d3d..7aa69df 100644 --- a/src/Spout/Writer/Internal/XLSX/Worksheet.php +++ b/src/Spout/Writer/Internal/XLSX/Worksheet.php @@ -134,7 +134,7 @@ EOD; foreach($dataRow as $cellValue) { $columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber); - $data .= '