public function machineryExport()
{
return Excel::download(new MachineryExport, 'machinery.csv');
}
my machineryexport look like
class MachineryExport implements FromView
{
/**
* @return \Illuminate\Support\Collection
*/
public function view(): View
{
return view('export.machinery', [
'equipments' => MachineryEquipment::get()
])->mergeCells('A1:E1');
}
}
I want to merge the cell A1 and A2 but i cant and colspan and row span also not worked
Hey @kevinRR, where did you find this syntax? 3.0 doesn't have a mergeCells
method and Laravel's view()
helper doesn't have it either.
In the current state of the package you'll have to follow the extending docs (https://laravel-excel.maatwebsite.nl/3.0/exports/extending.html#events) and use the native ->mergeCells('A1:E1')
method of PhpSpreadsheet. The AfterSheet
event is what you're looking for.
AfterSheet::class => function(AfterSheet $event) {
$event->sheet->getDelegate()->mergeCells('A1:E1');
},
This is my export file so how can i merge cell while passing to the view from my Export file
public function view(): View
{
return view('export.machinery', [
'equipments' => MachineryEquipment::get()
]);
}
I gave you the solution in my previous comment.
Most helpful comment
Hey @kevinRR, where did you find this syntax? 3.0 doesn't have a
mergeCells
method and Laravel'sview()
helper doesn't have it either.In the current state of the package you'll have to follow the extending docs (https://laravel-excel.maatwebsite.nl/3.0/exports/extending.html#events) and use the native
->mergeCells('A1:E1')
method of PhpSpreadsheet. TheAfterSheet
event is what you're looking for.