I am trying to run mail merge against a DOCX file using Open XML API - just replacing a <w:t>
element with a table (see below). Even the simplest table created using the following code results in Word erroring out when opening the file.
If I get rid of the row (so that I only have <w:tbl>
/ <w:tblGrid>
/ <w:GridCol>
). there is no error, but then I cannot have any data of course.
Can anybody see what I am doing wrong?
Table table = new Table(new TableGrid(new GridColumn() { Width = "2000"}),
new TableRow(new TableCell(new Paragraph(new Run(new Text("test")))))
);
TextNode.Parent.ReplaceChild<Text>(table, TextNode);