laravel - How to remove the column highlighting when using columnFormats? - Stack Overflow

I am using columnFormats() to format a column as a date:public function columnFormats(): array{return

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 can you try in the end of excel to $spreadsheet->getActiveSheet()->getCell('A1'); – francisco Commented Nov 19, 2024 at 9:42
  • @francisco thank you, do you know where I should put it? I tried the following which did not work: public function registerEvents(): array { return [ AfterSheet::class => function (AfterSheet $event) { $event->sheet->getCell('A1'); }, ]; } – pileup Commented Nov 19, 2024 at 15:58
  • @francisco, I did it, I used: $event->sheet->setSelectedCells('A1'); instead! thank you – pileup Commented Nov 19, 2024 at 16:00
Add a comment  | 

1 Answer 1

Reset to default 0

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745570482a4633650.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信