PHPExcel设置默认列宽 [英] PHPExcel set default Column Width
本文介绍了PHPExcel设置默认列宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天,我对excelphp有一点问题. 我想手动设置列的默认宽度,并且一次只能设置一次.
Today I had a little problem with excelphp. I wanted to set the default width of the columns manually and only one single time.
我在stackoverflow上也找到了一些解决方案,建议更改每个单列的值(例如,在循环中).
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.
推荐答案
浏览源代码后,我发现了以下解决方案:
After browsing the source code I found out the following solution:
$phpExcelObject->getActiveSheet()->getDefaultColumnDimension()
->setWidth($myCustomWidth);
我希望这对其他人有帮助;)
I hope that this helps anybody else ;)
这篇关于PHPExcel设置默认列宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文