Если вы строите документ из буквальных строк, вам нужно будет поработать:

я есть текст внутри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

иinnerXml из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.&lt;w:br /&gt;&lt;w:br /&gt;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("&lt;w:br /&gt;", "<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.

Ответы на вопрос(1)

Ваш ответ на вопрос