pileup
pileup

Reputation: 3272

How to remove the column highlighting when using columnFormats?

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:

enter image description here

Is it possible to remove this highlighting?

Upvotes: 0

Views: 37

Answers (1)

pileup
pileup

Reputation: 3272

If 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

Upvotes: 0

Related Questions