我里面有文字Run
元素。我正在尝试更换\r
在字符串中带有line break
.
正文如下
This is an example project for testing purposes. \rThis is all sample data, none of this is real information. \r\rThis field allows for the entry of more information, a larger text field for example purposes
and the innerXml
of the Run
元素被翻译成
<w:rPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:rFonts w:cstheme="minorHAnsi" />
</w:rPr>
<w:t xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
This is an example project for testing purposes. This is all sample data, none of this is real information.<w:br /><w:br />This field allows for the entry of more information, a larger text field for example purposes.</w:t>
生成文档时不会插入换行符。
我怎样才能替换里面的每个'\r'<w:t> </w:t>
有换行符吗?
我试过了。
s.InnerXml = s.InnerXml.Replace("<w:br />", "<w:br />");
我也尝试过直接在字符串中替换它,但这也不起作用。
它只是以字符串形式出现
This is an example project for testing purposes. This is all sample data, none of this is real information.<w:br xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" /><w:br xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" />This field allows for the entry of more information, a larger text field for example purposes.