Hi there,
I am working on a program that generates a considerable number of tables. Occasionally, a scenario something like the below example occurs, where two tables with different numbers of columns / general layout are directly adjacent.
using GemBox.Document;
using GemBox.Document.Tables;
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var doc = new DocumentModel();
var section = new Section(doc);
doc.Sections.Add(section);
var table1 = new Table(doc,
new TableRow(doc,
new TableCell(doc,
new Paragraph(doc, "Hello world"))));
var table2 = new Table(doc,
new TableRow(doc,
new TableCell(doc, new Paragraph(doc, "1")),
new TableCell(doc, new Paragraph(doc, "2")),
new TableCell(doc, new Paragraph(doc, "3")),
new TableCell(doc, new Paragraph(doc, "4")),
new TableCell(doc, new Paragraph(doc, "5"))));
table1.TableFormat.PreferredWidth = new TableWidth(100, TableWidthUnit.Percentage);
table2.TableFormat.PreferredWidth = new TableWidth(100, TableWidthUnit.Percentage);
section.Blocks.Add(table1);
section.Blocks.Add(table2);
doc.Save("test.docx");
Unfortunately, the behavior of Word when opening this document is to merge the two tables into a single table. This would not be a huge deal, except that GemBox does not explicitly declare the column layout for the second table, and thus Word does not preserve the original column spacing when merging the two tables. The below photos illustrate the issue, and the behavior I am after.
Actual Result

Desired Result

Is there any way to make this happen, preferably without inserting empty paragraphs in between the tables. I am ok with the tables merging, as long as the correct layout is preserved.
From what I can tell, the optimal result would be that GemBox always outputs the w:tblGrid column specification (or has some way to force it), while currently this is only done when cells use custom column spans. I have compared the XML output by GemBox with other document rendering solutions, and this seems to be the only major difference I can observe.