0
votes

I have a Microsoft Word 2013 document (.docx) which contains several Content Controls that are data bound using XPATH Xpressions to a Custom Xml Part inside the document.

When I double click the document, Microsoft Word opens it and fetches all data from the Custom Xml Part to populate the Content Controls and the document is visible with the real data.

What I need is, I want to populate the Content Controls with data from embedded Custom Xml Part, using Open Xml Sdk programatically and save the final rendered document.

Is this possible using Open Xml Sdk?

What I need is similar to this question which is unanswered:

https://stackguides.com/questions/25186629/generating-word-doc-populating-from-custom-xml-to-the-word-document-having-conte

1
it "should" be possible, but I tried to do it some weeks ago and I, sadly, finished by capitulating. I looked at a bunch of documentations, but none give the solution. It looks like a real advance feature to implement. If you have more luck than me (and no one had answered here), could you post the solution ?Maxime Porté
I am in hurry to implement the solution, I have a deadline. I will opt workarounds, I needed this for conversion to Pdf. If later, I get a solution, I will definitely post it.teenup

1 Answers

0
votes

This can be done using Open XML SDK, but it is tedious, error prone and if using native data binding mechanisms, you will be limited to single values only. Support for loops/repeating blocks has been added in Word 2013. I suggest you to take a look at this .NET toolkit which is very powerful and it doesn’t require you to code much.