Line Breaks in Cells

Topics: Developer Forum, User Forum
Apr 28, 2008 at 12:57 PM

is it possible to add line breaks in cells? In Excel it works with "Alt+Enter", but I haven't found any possibilite to do that with PHPExcel.
When I use \n or \r\n or PHP_EOL, it just prints an unknown character, but it doesn't make a line break.

Any help would be appreciated. :)
Apr 29, 2008 at 8:40 AM
Excel seems to do it with \n. Strange! Will look into this.
Apr 29, 2008 at 8:59 AM
Simply use \n and set the correct alignment: (wrap text)

Apr 29, 2008 at 12:00 PM
Ah, wrapText was missing.
Thanks, I love this library. :)

Another thing, although it's a bit offtopic:

I tried to set the alignment for a cell range by using duplicateStyleArray(), but I found out, that I can't use 'wraptext' => true, but 'wrap' => true.
Same thing with NumberFormat, the function is named setFormatCode() but the array expects only 'code'.

Is there a list of valid index values which can be used in the style array? (and maybe their corresponding functions?)

It's not too urgent, since I already was able to find out the correct values, but I think it'might come in handy. :)
Apr 29, 2008 at 4:39 PM
Good suggestion! Will make a work item for this and add it to the developer documentation.
Apr 29, 2008 at 4:40 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.