withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Description')->withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Price')->withSettings(ColumnSettingFlags::EXPORTABLE), new Column('Stock')->withSettings(ColumnSettingFlags::EXPORTABLE) ); $this->tableSettings = new GenericTableSettings( Product::class, $columns ); } public function onExport(ExportEventArgs $args) : BinaryFileResponse|Response { $args->query->take(5); $args->settings->useFormatters = true; $args->settings->fileName = 'products'; $args->useStripTags = true; return $args->export(); } #[CellFormatter('price')] public function priceFormatter(Cell $cell) { return '$'.$cell->value; } #[CellFormatter('name')] public function nameFormatter(Cell $cell) { return 'La ' . $cell->value; } }