Skip to content

Commit

Permalink
Merge pull request #133 from lukasinko/enable-headers-style
Browse files Browse the repository at this point in the history
[fixes #132] Don't treat headers as regular rows (so style can be app…
  • Loading branch information
alperenersoy authored Sep 21, 2024
2 parents 3392079 + 4fd2ddc commit d745d6b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/FilamentExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ public function download(): StreamedResponse
return response()->streamDownload(function () {
$headers = $this->getAllColumns()->map(fn ($column) => $column->getLabel())->toArray();

$stream = SimpleExcelWriter::streamDownload("{$this->getFileName()}.{$this->getFormat()}", $this->getFormat(), delimiter: $this->getCsvDelimiter())
->noHeaderRow()
->addRows($this->getRows()->prepend($headers));
$stream = SimpleExcelWriter::streamDownload("{$this->getFileName()}.{$this->getFormat()}", $this->getFormat(), delimiter: $this->getCsvDelimiter());

if ($modifyExcel = $this->getModifyExcelWriter()) {
$stream = $modifyExcel($stream);
}

$stream->addHeader($headers);
$stream->addRows($this->getRows());

$stream->close();
}, "{$this->getFileName()}.{$this->getFormat()}");
}
Expand Down

0 comments on commit d745d6b

Please sign in to comment.