1. Go to this page and download the library: Download wali/filament-word-export library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wali / filament-word-export example snippets
use Wali\FilamentWordExport\Actions\ExportToWordAction;
public function table(Table $table): Table
{
return $table
->columns([
// Your table columns
])
->bulkActions([
ExportToWordAction::make(),
]);
}
use Wali\FilamentWordExport\Actions\ExportToWordAction;
public function table(Table $table): Table
{
return $table
->bulkActions([
// Custom header and footer text
ExportToWordAction::make()
->headerText('My Company Report')
->footerText('Confidential Document')
->withPageNumbers(),
// Disable headers/footers entirely
ExportToWordAction::make('export-clean')
->label('Export (Clean)')
->withoutHeader()
->withoutFooter(),
// Custom filename
ExportToWordAction::make('export-custom')
->filename('custom-report-' . now()->format('Y-m-d') . '.docx'),
]);
}