diff --git a/src/FilamentExport.php b/src/FilamentExport.php index f7ba2dd..776a854 100644 --- a/src/FilamentExport.php +++ b/src/FilamentExport.php @@ -32,6 +32,7 @@ use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Date; +use Illuminate\Support\HtmlString; use Spatie\SimpleExcel\SimpleExcelWriter; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -130,7 +131,7 @@ public function download(): StreamedResponse } return response()->streamDownload(function () { - $headers = $this->getAllColumns()->map(fn ($column) => $column->getLabel())->toArray(); + $headers = $this->getAllColumns()->map(fn ($column) => ($column->getLabel() instanceof HtmlString ? strip_tags($column->getLabel()) : $column->getLabel()))->toArray(); $stream = SimpleExcelWriter::streamDownload("{$this->getFileName()}.{$this->getFormat()}", $this->getFormat(), delimiter: $this->getCsvDelimiter()) ->noHeaderRow()