example:
Excel::create('test.xls', function($excel) {
$excel->sheet('sheet', function($sheet) {
$sheet->row(1, ['text for example text for example text for example']);
$sheet->setWidth([
'A' => 30
]);
$sheet->setHeight(1, 60);
$sheet->cell('A1', function($cell) {
$cell->setAlignment('center');
$cell->setFont(array(
'size' => '16',
'bold' => true
));
});
});
})->store('xls', storage_path('excel/exports'));
How to word wrap?
At this moment only like this:
$sheet->getStyle('A1')->getAlignment()->setWrapText(true);
thanks
its work
its work! thanks!
How to do that in laravel-excel 3.1 ?
@FauzanAldi
How to do that in laravel-excel 3.1 ?
namespace App\Exports;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class InvoicesExport implements WithStyles
{
public function styles(Worksheet $sheet)
{
$sheet->getStyle('A1')->getAlignment()->setWrapText(true);
}
}
or you could also do it like this
namespace App\Exports;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class InvoicesExport implements WithStyles
{
public function styles(Worksheet $sheet)
{
return [
'A1' => ['alignment' => ['wrapText' => true]],
];
}
}
Most helpful comment
At this moment only like this: