This project has moved and is read-only. For the latest updates, please go here.

Inserting Documents with Tables

Sep 23, 2013 at 8:49 PM
First off, thanks for all the hard work on DocX it's awesome!

I'm using DocX to create merge letters where I have a set of records that I merge with a .docx template and insert into a new document as a new page. The basic logic is open a template .docx file replace the merge fields and then add it to a new document, iterate to the next record, merge the fields, add it to the same document as page 2, repeat...

I'm finding that if my template file contains a table that the table loses it's formatting the first time it's inserted to the new document. On subsequent inserts the formatting is fine. When I look at the contents of the final document I see that the first table has this for the styling:

<w:tblStyle w:val="def81b21-62a7-4c13-940b-34642fec14cd"/>

While every following table, which is formatted correctly has

<w:tblStyle w:val="TableGrid"/>

Any thoughts?