I want to control column width , but I just found "Auto size" in document , it can't fit what I want . Is there a method like "setWidth" to control column width ?
No description.
Expected behavior:
A way to set column width .
Actual behavior:
I can't find any method to do that. Sorry
No additional information
Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. We need to know which version you use and how to reproduce it. Please include code examples. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/contributing) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues.
What is this column you're talking about? Is it a table column, modified css column or any other things?
You suggest you to add some of your codes to help us identify the issue.
Sorry to make you confused . I just want to modify the excel(after I export some data to excel) sheet column width . I remember there is a setWidth method in version 2 like this:
Excel::create('abc', function($excel) {
$excel->sheet('缁熻淇℃伅', function($sheet){
$sheet->setWidth(array(
'A' => 10,
'B' => 30,
'C' => 15,
'D' => 15,
'E' => 15,
'F' => 15,
));
$sheet->rows($rows);
});
})
I want to do the same thing ,thanks
You'll have to use PhpSpreadsheet native methods in a AfterSheet event. https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/#setting-a-columns-width
The link above is broken. You can try this:
https://laravel-news.com/five-hidden-features-of-the-laravel-excel-package
https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#setting-a-columns-width
I did this:

This also works. Remember to implement WithEvents concern and use the RegistersEventListeners trait.

Most helpful comment
The link above is broken. You can try this:
https://laravel-news.com/five-hidden-features-of-the-laravel-excel-package
https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#setting-a-columns-width
I did this:
