我正在尝试在 php 中使用 html 生成一个 excel 文件,并使用 excel 内容类型进行响应。除了单元格中的新行外,一切正常。它们没有保存下来。 我试过 ; ;\r\n ,chr(13).chr(10) 它没有用。 我正在尝试通过 Microsoft Excel 的 alt + enter 获得相同的结果。
我在单元格中生成如下内容:
http:\\www.example.com\blah
(Link)
http:\\www.example.com\blah2
(Event) ...
这些必须在一个单元格中,并且将链接文本转换为超链接会很棒 :)。
最佳答案
我在这里找到了解决方案:http://www.bennadel.com/blog/1095-maintaining-line-breaks-in-an-html-excel-file.htm
The solution I found is to add into a stylesheet:
br {mso-data-placement:same-cell;}
关于php - 在通过 html 生成的 excel 单元格中添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4025754/