From 33fa9091986a5bb0ded135ef0c579c48ecf7208d Mon Sep 17 00:00:00 2001 From: Rushi Vishavadia Date: Tue, 2 Feb 2016 10:20:21 +0530 Subject: [PATCH] XOL-2734 null checks should be strict so that integer 0 is written into the cell --- Service/ExcelWriter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Service/ExcelWriter.php b/Service/ExcelWriter.php index 58fb666..e03011e 100644 --- a/Service/ExcelWriter.php +++ b/Service/ExcelWriter.php @@ -83,7 +83,7 @@ public function writeHeaders($headers, $initRow = null) $hasMultiRowHeaders = $this->hasMultiRowHeaders($headers); if ($initRow) { - $worksheet->insertNewRowBefore($initRow, 2); + $worksheet->insertNewRowBefore($initRow, 1); } else { $initRow = $this->currentRow; } @@ -128,7 +128,7 @@ public function writeHeaders($headers, $initRow = null) $worksheet->calculateColumnWidths(true); - $this->currentRow += ($hasMultiRowHeaders) ? 2 : 1; + $this->currentRow = $initRow + (($hasMultiRowHeaders) ? 2 : 1); } /** @@ -222,7 +222,7 @@ public function writeRow($dataRow, $headers = []) private function writeArrays(array $lines) { $startCell = 'A' . $this->currentRow; - $this->handle->getActiveSheet()->fromArray($lines, null, $startCell); + $this->handle->getActiveSheet()->fromArray($lines, null, $startCell, true); $this->currentRow += count($lines); } @@ -234,7 +234,7 @@ private function writeArrays(array $lines) private function writeArray(array $row) { $startCell = 'A' . $this->currentRow; - $this->handle->getActiveSheet()->fromArray([$row], null, $startCell); + $this->handle->getActiveSheet()->fromArray([$row], null, $startCell, true); $this->currentRow++; }