Skip to content

Commit

Permalink
XOL-2733 Fix logic for writing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi committed Jan 27, 2016
1 parent 12834e2 commit 989d1df
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Service/ExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,20 @@ public function setSheetTitle($title)
* Write the headers (nested or otherwise) to the current active worksheet
*
* @param $headers
* @param $initRow
*
* @throws \PHPExcel_Exception
*/
public function writeHeaders($headers, $initRow = null)
{
$worksheet = $this->handle->getActiveSheet();

$initRow = ($initRow) ? $initRow : $this->currentRow;
if ($initRow) {
$worksheet->insertNewRowBefore($initRow, 2);
} else {
$initRow = $this->currentRow;
}

$column = 'A';
foreach ($headers as $idx => $header) {
$cell = $column . $initRow;
Expand Down

0 comments on commit 989d1df

Please sign in to comment.