来自PHP DOM的单元格中的Excel XML换行符

问题描述:

我正在尝试在Excel XML文档中插入新行.我需要插入的实体是
 ,但是每当我将其插入PHP DOM时,它只会将其转换为正常的换行符.

I am trying to insert new lines into an Excel XML document. The entity that I need to insert is 
 but whenever I insert that into PHP DOM, it just converts it to a normal line break.

这就是我得到的:

<Cell><Data>text
text2
</Data></Cell>

这就是我想要的:

<Cell><Data>text&#10;text2&#10;</Data></Cell>

我无法弄清楚如何插入新行并以这种方式对其进行编码,或者添加没有该字符的字符,要么对其进行双重编码,要么将其转换为新行.

I cannot figure out how to insert a new line and get it to encode that way, or add that character without it either double encoding it, or converting it to a new line.

感谢您的帮助!

使用CDATA部分...

Use a CDATA section...