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 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示