I am using columnFormats()
to format a column as a date:
public function columnFormats(): array
{
return [
'C' => NumberFormat::FORMAT_DATE_DDMMYYYY
];
}
But it also highlights the formatted column on the exported excel file whenever it's first opened:
Is it possible to remove this highlighting?
I am using columnFormats()
to format a column as a date:
public function columnFormats(): array
{
return [
'C' => NumberFormat::FORMAT_DATE_DDMMYYYY
];
}
But it also highlights the formatted column on the exported excel file whenever it's first opened:
Is it possible to remove this highlighting?
Share Improve this question edited Nov 19, 2024 at 15:24 pileup asked Nov 19, 2024 at 9:14 pileuppileup 3,3305 gold badges31 silver badges69 bronze badges 3 |1 Answer
Reset to default 0If anyone ever encounters this in the future, this is how I solved it:
public function registerEvents(): array {
return [
AfterSheet::class => function (AfterSheet $event) {
$event->sheet->setSelectedCells('A1');
},
];
}
I select the first cell in the sheet and it removes the highlighting
$spreadsheet->getActiveSheet()->getCell('A1');
– francisco Commented Nov 19, 2024 at 9:42public function registerEvents(): array { return [ AfterSheet::class => function (AfterSheet $event) { $event->sheet->getCell('A1'); }, ]; }
– pileup Commented Nov 19, 2024 at 15:58$event->sheet->setSelectedCells('A1');
instead! thank you – pileup Commented Nov 19, 2024 at 16:00