I have a document with a number of paragraphs, a table and then a few more paragraphs. Lets say the table has three columns and two rows where the first row is a header and the second row needs to be repeated for each item in a collection of data. Also, the table may be repeated for each item in a collection of data.
I load the document into a Novacode.DocX object then process each paragraph in the Paragraph collection, appending the paragraphs to a new DocX object based on certain instructions. The instructions may indicate that the paragraphs are conditional or repeating.
This works fine until I encounter a table. Each cell in the table is represented as a paragraph (or paragraphs) in the collection of Paragraphs. The only distinguishing property is the paragraph's ParentContainer. When I encounter a paragraph contained in a table, I attempt to append a table to the new document but this never ends up in the right place. There doesn't appear to be any way to determine where in the document the table is to be positioned. I have tried to find a connection between the items in the Tables collection and the items in the Paragraphs collection but there doesn't appear to be anything. Also the Tables collection doesn't appear to have any properties relating to its location in the document.
I am certain it can't be this hard. What am I missing?