I need to generate .docx/.xlsx files in .NET from some kind of templates (for generating contracts, invoices, etc.)... I've found some information about custom XML parts in OpenXML format and binding data from this parts to document, so i can bind simply fields from my custom XML part...
My main question is - how i can bind some document part to collection in my XML? As example, i have this XML as custom XML part in my .docx document:
<Data>
<Name>Superman</Name>
<Collection>
<CollectionItem>
<Data1>1</Data1>
<Data2>11</Data2>
</CollectionItem>
<CollectionItem>
<Data1>2</Data1>
<Data2>22</Data2>
</CollectionItem>
<CollectionItem>
<Data1>3</Data1>
<Data2>33</Data2>
</CollectionItem>
<CollectionItem>
<Data1>4</Data1>
<Data2>44</Data2>
</CollectionItem>
</Collection>
</Data>
And i can bind Name tag to text content control. Is it possible to make list or table and bind list item or table row to CollectionItem tag? As example i want to have next table to be generated from XML example above:
+-------------------|----------------------+
| Header1 | Header2 |
+-------------------|----------------------+
| 1 | 11 |
+-------------------|----------------------+
| 2 | 22 |
+-------------------|----------------------+
| 3 | 33 |
+-------------------|----------------------+
| 4 | 44 |
+-------------------|----------------------+
And second part of my question: is it possible to replace this custom XML part via .NET and OpenXML SDK, and if it is possible - how i can do this?