I get tutorial from here : https://laravel-excel.maatwebsite.nl/3.0/exports/extending.html
So I use version 3
My excel like this :
I want to change it to be like this :
So I want the character England
change to red color and bold
I try like this :
namespace App\Exports;
...
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\BeforeExport;
use Maatwebsite\Excel\Events\AfterSheet;
class SummaryExport implements FromView, WithEvents
{
...
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$event->sheet->styleCells(
'B1:D1',
[
'borders' => [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => 'EB2B02'],
],
]
]
);
},
];
}
}
There exist error like this :
Method Maatwebsite\Excel\Sheet::styleCells does not exist.
How can I solve this error?
styleCells
macro ? – Kruterboot
method. – Bracing