Skip to content

Commit

Permalink
Merge pull request #4 from rushi/XOL-2734
Browse files Browse the repository at this point in the history
XOL-2734 Fix for writing 0 integer values into the cell
  • Loading branch information
rushi committed Feb 2, 2016
2 parents 5d96778 + 33fa909 commit aed7a70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Service/ExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public function writeHeaders($headers, $initRow = null)

$worksheet->calculateColumnWidths(true);

$this->currentRow += ($hasMultiRowHeaders) ? 2 : 1;
$this->currentRow = $initRow + (($hasMultiRowHeaders) ? 2 : 1);
}

/**
Expand Down Expand Up @@ -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);
}

Expand All @@ -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++;
}

Expand Down

0 comments on commit aed7a70

Please sign in to comment.