locked
Saving a document as XML results in text being split between tags. RRS feed

  • Question

  • Hello,

    The Access application I'm working on, will be compiling letters to customers, saving them as pdf's, and then pass them on to a document management system. In order to speed things up a bit, I would like to use XML for all text manipulation, since using Find and Replace in Word takes too much time.

    However, as mentioned in the subject field, the XML saved by Word is not as expected.

    Pieces of text are randomly split between tags.

    Does anyone know why Word does this, and is there a way around this?

    Thanks in advance,

    Klaas

    Wednesday, July 15, 2020 10:18 AM

All replies

  • In HTML, the word "runs" in following sentence will be split by <em> or <b> tags. In contrast, Word splits text into runs to apply character-based formatting. The splitting is not random. Here is XML for a sentence with a bolded word:

    <w:r>
      <w:t xml:space="preserve">Video provides a </w:t>
    </w:r>
    <w:r w:rsidRPr="00966A38">
      <w:rPr>
        <w:b/>
        <w:bCs/>
      </w:rPr>
      <w:t>powerful</w:t>
    </w:r>
    <w:r>
      <w:t xml:space="preserve"> way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.</w:t>
    </w:r>
    Unfortunately for your intended workflow, when character formatting is removed, Word does not remove the runs. I think you may have to stick with Find and Replace.
    Wednesday, July 15, 2020 4:33 PM
  • Hi Klaas,

    Just checking in to see if the information was helpful. Please let us know if you would like further assistance.

    This “Word IT Pro Discussions” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Regards,

    Emi Zhang


    "Office" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "Office" forums' new home on Microsoft Q&A !

    Thursday, July 16, 2020 8:21 AM