-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize cells #191
Comments
You probably need to extend the Exportable and add the methods from |
how to do it? |
Maybe you figured it out already but I was looking for the same thing. For future reference, here is how I solved it. First, create a custom export as explained here: https://github.com/pxlrbt/filament-excel?tab=readme-ov-file#custom-exports use pxlrbt\FilamentExcel\Actions\Tables\ExportAction;
use pxlrbt\FilamentExcel\Exports\ExcelExport;
use pxlrbt\FilamentExcel\Columns\Column;
class CustomExport extends ExcelExport
{
public function setUp()
{
$this->withFilename('custom_export');
$this->withColumns([
Column::make('name'),
Column::make('email'),
]);
}
} Then make sure the class implements the WithStyles interface: use Maatwebsite\Excel\Concerns\WithStyles;
class CustomExport extends ExcelExport implements WithStyles
{
.... At last, implement the public function styles: class CustomExport extends ExcelExport implements WithStyles
{
...
public function styles(Worksheet $sheet)
{
return [
1 => ['font' => ['bold' => true]],
'D' => ['alignment' => ['horizontal' => 'right']],
];
} In this example, the header row will be bold and the 4th column will be right aligned. Hope this helps! |
@Priet Thanks for sharing. |
Is there any way to customize, for example: Alignment, type of data entered (text, number, general), cell coloring, etc.?
The text was updated successfully, but these errors were encountered: