donglin8467 2017-05-18 12:45 采纳率: 0%
浏览 986
已采纳

使用php xlsx writer在字符串中创建excel换行符

I'm using php xlsx writer (https://github.com/mk-j/PHP_XLSXWriter) to create my excel file and try to figure out how to force excel to make a line break.

My source data contains html tags (<br />) and i want to replace them with the correct formular. The replace function is working but i need how the string needs to be formated to force the break.

The line wrap option at format cells is enabled for the column as shown in the picture below (excel is installed german at the moment - please don't hate me for that)

enter image description here

What i tried so far is using CHAR(10) and CHAR(13) - altough CHAR(13) should be for mac and i am on windows.

I tried the following inputs to get my line break working. Also i tried all of the combinations with and instead of CHAR(10) and CHAR(13)

="text"&CHAR(10)&"text"
='text'&CHAR(10)&'text'
=text&CHAR(10)&text

The data was entered in the formular row in excel (picture below) - i think this is the only possible location to enter this isn't it?

enter image description here

Whatever i try my output always looks like this:

enter image description here

Any suggestions what i could do?
Thanks for your help!

  • 写回答

1条回答 默认 最新

  • dsk88199 2017-05-23 07:18
    关注

    The question got answered in https://github.com/mk-j/PHP_XLSXWriter/issues/114. There was a release of a new brunch supporting new line character which fixed the problem.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的