How do I write Alt+Enter to a spreadsheet using PHP?
I want to place Alt+Enter (line break) in a cell in an Excel spreadsheet. How do I write a character which is equiva开发者_如何学Golent to Alt+Enter?
\n
is the escape-sequence for a line-break in a String.
\n
is for line break
<br/>
is for html break
For Windows only (you mention Excel) the escape-sequence is \r\n
.
Try using CHAR(10)
<string1> & CHAR(10) & <string2>
it will produce
<string1>
<string2>
in the excel cell.
Please try to insert in following form:
"\="."\"string1\""."&char(10)&"."\"string2\""
After saving it xls through PHP
Apply wrap text on each column where your insert data
精彩评论