Skip to content

Commit

Permalink
Fix additional empty worksheet in excel creation
Browse files Browse the repository at this point in the history
When instancing the ExcelWriter class, if the first sheet is given a custom name the class adds an empty 'Worksheet'. This is due to the creation of a default sheet operated by the construct of the PHPExcel class.
  • Loading branch information
falcecamogli committed Oct 14, 2015
1 parent c116e32 commit d4b7246
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Writer/ExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public function prepare()
$this->excel = $reader->load($this->filename);
} else {
$this->excel = new PHPExcel();
if(null !== $this->sheet && !$this->excel->sheetNameExists($this->sheet))
{
$this->excel->removeSheetByIndex(0);
}
}

if (null !== $this->sheet) {
Expand Down

0 comments on commit d4b7246

Please sign in to comment.