From bffe363a52a78f396ad591269d8d6cf1bd2f2a04 Mon Sep 17 00:00:00 2001 From: Andriy Ivanchenko Date: Fri, 6 Nov 2015 10:51:26 +0200 Subject: [PATCH] too big xml file for xlsx --- src/Spout/Writer/XLSX/Internal/Worksheet.php | 36 +++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/Spout/Writer/XLSX/Internal/Worksheet.php b/src/Spout/Writer/XLSX/Internal/Worksheet.php index be67e19..c6f77e6 100644 --- a/src/Spout/Writer/XLSX/Internal/Worksheet.php +++ b/src/Spout/Writer/XLSX/Internal/Worksheet.php @@ -133,28 +133,26 @@ EOD; $data = ''; - foreach($dataRow as $cellValue) { - $columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber); - $data .= 'getId() . '"'; - - if (CellHelper::isNonEmptyString($cellValue)) { - if ($this->shouldUseInlineStrings) { - $data .= ' t="inlineStr">' . $this->stringsEscaper->escape($cellValue) . ''; + foreach ($dataRow as $cellValue) { + if (!empty($cellValue)) { + $columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber); + $data .= 'getId() . '"'; + if (CellHelper::isNonEmptyString($cellValue)) { + if ($this->shouldUseInlineStrings) { + $data .= ' t="inlineStr">' . $this->stringsEscaper->escape($cellValue) . ''; + } else { + $sharedStringId = $this->sharedStringsHelper->writeString($cellValue); + $data .= ' t="s">' . $sharedStringId . ''; + } + } else if (CellHelper::isBoolean($cellValue)) { + $data .= ' t="b">' . $cellValue . ''; + } else if (CellHelper::isNumeric($cellValue)) { + $data .= '>' . $cellValue . ''; } else { - $sharedStringId = $this->sharedStringsHelper->writeString($cellValue); - $data .= ' t="s">' . $sharedStringId . ''; + throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cellValue)); } - } else if (CellHelper::isBoolean($cellValue)) { - $data .= ' t="b">' . $cellValue . ''; - } else if (CellHelper::isNumeric($cellValue)) { - $data .= '>' . $cellValue . ''; - } else if (empty($cellValue)) { - $data .= '/>'; - } else { - throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cellValue)); } - $cellNumber++; }