Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPExcel set default Column Width

Tags:

phpexcel

Today I had a little problem with excelphp. I wanted to set the default width of the columns manually and only one single time.

I found a few solutions also here on stackoverflow which suggested to change the value for every single column (e.g. within a loop).

But I wanted to do it with a single command.

like image 399
yacon Avatar asked May 21 '14 08:05

yacon


1 Answers

After browsing the source code I found out the following solution:

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

I hope that this helps anybody else ;)

like image 135
yacon Avatar answered Sep 20 '22 16:09

yacon