I use the OpenXML SDK to generate 2013 word files. I work on the server (part of the server solution), so automation is not an option.
Basically, I have an xml file that is output from the backend system. Here is a very simplified example:
<my:Data
xmlns:my="https://schemas.mycorp.com">
<my:Customer>
<my:Details>
<my:Name>Customer Template</my:Name>
</my:Details>
<my:Orders>
<my:Count>2</my:Count>
<my:OrderList>
<my:Order>
<my:Id>1</my:Id>
<my:Date>19/04/2017 10:16:04</my:Date>
</my:Order>
<my:Order>
<my:Id>2</my:Id>
<my:Date>20/04/2017 10:16:04</my:Date>
</my:Order>
</my:OrderList>
</my:Orders>
</my:Customer>
</my:Data>
Then I use the Word Xml display panel to map this data to the content:
I simply duplicate the word file and write new Xml data when creating new files.
This works as expected. When I update the xml part, it displays data from my backend.
Thought there is a case that does not work. If the customer does not have an order, the contents of the template are stored in the document . Xml data:
<my:Data
xmlns:my="https://schemas.mycorp.com">
<my:Customer>
<my:Details>
<my:Name>Some customer</my:Name>
</my:Details>
<my:Orders>
<my:Count>0</my:Count>
<my:OrderList>
</my:OrderList>
</my:Orders>
</my:Customer>
</my:Data>
(see the empty list of orders).
Word xml ( no Order node):
, , .
, , (, , ).
?
PS: , xml PowerShell script, : repro.zip