Exportファイル
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<?php namespace App\Exports; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Events\AfterSheet; class Export implements FromView, WithEvents { private $view; public function __construct(View $view) { $this->view = $view; } /** * @return View */ public function view(): View { return $this->view; } /** * Write code on Method * * @return response() */ public function registerEvents(): array { return [ AfterSheet::class => function(AfterSheet $event) { //$event->sheet->getDelegate()->getRowDimension('1')->setRowHeight(40); $event->sheet->getDelegate()->getColumnDimension('A')->setWidth(30); $event->sheet->getDelegate()->getColumnDimension('B')->setWidth(40); $event->sheet->getDelegate()->getColumnDimension('C')->setWidth(10); }, ]; } } |
参考サイト
Laravel Maatwebsite Excel Set Cell Height and Width Example
https://www.itsolutionstuff.com/post/laravel-maatwebsite-excel-set-cell-height-and-width-exampleexample.html#google_vignette