PHPExcel sets default column width

Today I had a little problem with excelphp. I wanted to set the default column width manually and only once.

I found several solutions here in stackoverflow, which suggested changing the value for each individual column (for example, inside a loop).

But I wanted to do this with one command.

+6
source share
1 answer

After looking at the source code, I found the following solution:

$phpExcelObject->getActiveSheet()->getDefaultColumnDimension() ->setWidth($myCustomWidth); 

I hope this helps someone else;)

+20
source

Source: https://habr.com/ru/post/969628/


All Articles