SpartnerNL / Laravel-Excel

🚀 Supercharged Excel exports and imports in Laravel
https://laravel-excel.com
MIT License
12.28k stars 1.92k forks source link

[Bug]: columnWidths invalid #4060

Closed zhuman90 closed 9 months ago

zhuman90 commented 10 months ago

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

What version of Laravel Excel are you using?

3.1.51

What version of Laravel are you using?

10.38.1

What version of PHP are you using?

8.2

Describe your issue

image image

Even though I set the columnWidths, the exported CSV file still has unchanged column widths.

How can the issue be reproduced?

class XXX implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithColumnWidths 
{
  public function columnWidths(): array
      {
          return [
              'A' => 100,
              'B' => 100,
              'C' => 100,
              'D' => 100,
              'E' => 100,
              'F' => 100,
              'G' => 100,
              'H' => 100,
              'I' => 100,
              'J' => 100,
              'K' => 100,
              'L' => 100,
              'M' => 100,
              'N' => 100,
              'O' => 100,
              'P' => 100,
              'Q' => 100,
              'R' => 100,
              'S' => 100,
              'T' => 100,
          ];
      }
}

What should be the expected behaviour?

set column width

patrickbrouwers commented 10 months ago

I think it's because you have the autosize concern