Skip to content

Commit

Permalink
Fix borders for merged cell, for all write methods (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferryvg authored and patrickbrouwers committed Oct 18, 2016
1 parent 7d8e51b commit 55d18b6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Maatwebsite/Excel/Writers/LaravelExcelWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,6 @@ public function export($ext = 'xls', Array $headers = array())
// Set the extension
$this->ext = $ext;

//Fix borders for merged cells
foreach($this->getAllSheets() as $sheet){

foreach($sheet->getMergeCells() as $cells){

$style = $sheet->getStyle(explode(':', $cells)[0]);

$sheet->duplicateStyle($style, $cells);
}
}

// Render the file
$this->_render();

Expand Down Expand Up @@ -423,6 +412,17 @@ public function save($ext = 'xls', $path = false, $returnInfo = false)
*/
protected function _render()
{
//Fix borders for merged cells
foreach($this->getAllSheets() as $sheet){

foreach($sheet->getMergeCells() as $cells){

$style = $sheet->getStyle(explode(':', $cells)[0]);

$sheet->duplicateStyle($style, $cells);
}
}

// There should be enough sheets to continue rendering
if ($this->excel->getSheetCount() < 0)
throw new LaravelExcelException('[ERROR] Aborting spreadsheet render: no sheets were created.');
Expand Down

0 comments on commit 55d18b6

Please sign in to comment.