Knowledgebase

Inserting a carriage return into an Excel document, via PHP

Posted by BurakUeda, 07-20-2008, 09:18 AM
Trying to create an .xls document on the fly, using PEAR Spreadsheet_Excel_Writer. Everything seems fine so far, except I cannot insert a carriage return into a cell. \l, \l\r, chr(13) none is working. I am not an Excel user, so anyone has any idea how can I accomplish this?

Posted by Eanix, 07-20-2008, 09:47 AM
Have you tried \r\n ?

Posted by BurakUeda, 07-20-2008, 10:49 AM
Thanks Eanix, It works in a weird way. Entering the data in each cell like this: Number:0\r\nnextline Number:1\r\nnextline Number:2\r\nnextline Number:3\r\nnextline When I run the script and view the file in Excel, it looks like: Number:0nextline Number:1nextline Number:2nextline Number:3nextline But after I double click each cell, it gets formatted automatically: Number:0 nextline Number:1 nextline Number:2 nextline Number:3 nextline

Posted by BurakUeda, 07-20-2008, 11:04 AM
Fixed I needed to use setTextWrap() function...



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Alternative for spark (Views: 603)
help me with vps error (Views: 645)
ThePlanet/ServerMatrix (Views: 616)


Language:

Client Login

Email

Password

Remember Me

Search