How to set auto-line break PhpExcel?

三世轮回 提交于 2020-01-11 06:44:07

问题


I'm using PHPExcel to generate some excel export. Excel has an autoline break feature. How can i activate this ?

My customer use only Microsoft Excel, so it don't have to support others programs.

Any ideas ?

I may use something like this : how to make New lines in a cell using phpexcel But that's more a kind of hack, than a real solution.

UPDATE : See, once columns are merged, wrap text fail. I tryied to add wrap text upon every column merged, but it don't affect result.

UPDATE 2 :

The cells are merged, then i add wrap text, then i add text.


回答1:


Set the column to a fixed width; setWrapText(true) for the cells, and see what happens.

Look at the second sheet created in /Tests/05featuredemo.php for an example.

You only need to use \n if you want to control exactly where a line wraps



来源:https://stackoverflow.com/questions/13071752/how-to-set-auto-line-break-phpexcel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!