none
RTF inside WordProcessing.Paragraph RRS feed

  • Question

  • Hi,

    We have a program which takes .docx-files and replaces certain texts (eg. 'something1') with certain replacement values.

    Everything goes well when we replace these texts with normal text, but sometimes we want to replace them with RTF-formatted texts. We would do this with AltChunk. When we try to replace these texts, which are inside a Text-element (<w:t>), which are inside a Run-element (<w:r>), which are inside a Paragraph-element (<w:p>), this isn't very reliable (which is to be expected seen the documentation about OpenXML), because sometimes there is some text in the same paragraph after the texts we wish to replace (which would be replaced with an RTF-text using AltChunk). Now our only option is to cut-off the paragraph, insert the RTF at the cut-off, and recommence the rest of our previous paragraph on a new paragraph. Then we would later have to merge the cut-off paragraphs back together, when de AltChunks are applied in the document.

    Is there any way (not using Interop) to insert some RTF-text inside the middle of a paragraph in OpenXML?

    Thanks in advance!

    Renaud Leroy

    Tuesday, March 10, 2020 7:55 AM