Share via

Refresh XML data in WORD

Anonymous
2018-02-13T14:56:34+00:00

Dear colleagues ,

I have mapped some XLS data inside my  Word file. I would like to change a external XML file , then "refresh" WORD file in order to update all information from XML file.

In excel there is a fucntion for XML Refresh that works very well, but in WORD, i can't find the same function.

Please, some one know a solution

Regards,

Romulo

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2018-02-16T07:29:01+00:00

Are you using VSTO?

I was not sure whether you are saying 

 a. "In the past I have been able to map XLS data in Word and now I would like to do the same thing with XML data" or

 b. I have mapped some XLS data in Word but it originates from XML data - how do I update it?

If it is (b), how have you mapped the XLS data and why would you expect to be able to refresh the data without refreshing the XLS?

If it is (a), then the problem is that there is no equivalent of the Excel XML mapping process in Word. There are several things you could do - probably the simplest would be along the following lines:

 a. use Word content controls mapped to a Custom XML Part to insert the data in Word

 b. Use VBA (or whatever) to get the data you need from the external XML and copy it into the Custom XML Part

 c. either rely on Word's Custom XML events to update the content control values or force them to refresh their data - at this point I do not know whether the "events" approach is workable

Another approach might be to use INCLUDETEXT fields to insert the appropriate data from  your XML source using a piece of XPath to identify the appropriate nodes. This is only really "simple" in the case where you are inserting the values of easily-identified individual elements or attributes in various parts of your document, cf. inserting links to different Excel cells. If you need more than that, it gets much harder as you would need to write some XSL transforms

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2018-02-16T17:32:44+00:00

    1- I am not using VSTO.

    2- The question is : b. I have mapped some XML (NOT XLS )data in Word but it originates from XML data - how do I update it?

    3-As you said, unfornutaly "then the problem is that there is no equivalent of the Excel XML mapping process in Word"

    4- Right now i am using the .docx properties in order to change parts of the document. This solve my problem.

    Thank you very much.

    Best Regards.

    Romulo

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-02-13T16:40:50+00:00

    I would like to refresh just the Word file.

    Thanks ,

    Romulo

    Was this answer helpful?

    0 comments No comments
  3. Vijay A. Verma 104.9K Reputation points Volunteer Moderator
    2018-02-13T16:03:58+00:00

    Does this xml file refresh the embedded Excel files or something else in the Word?

    Was this answer helpful?

    0 comments No comments