Hi,
when I try to combine two tables in a single Worddocument with the code you have provided in your programmer’s guide:
// Load the document.
Document doc = new Document(getMyDir() + "Table.Document.doc");
// Get the first and second table in the document.
// The rows from the second table will be appended to the end of the first table.
Table firstTable = (Table)doc.getChild(NodeType.TABLE, 0, true);
Table secondTable = (Table)doc.getChild(NodeType.TABLE, 1, true);
// Append all rows from the current table to the next.
// Due to the design of tables even tables with different cell count and widths can be joined into one table.
while (secondTable.hasChildNodes())
firstTable.getRows().add(secondTable.getFirstRow());
// Remove the empty table container.
secondTable.remove();
doc.save(getMyDir() + "Table.CombineTables Out.doc");
with either of the two table structures as seen in ‘TableOne.docx’ and ‘TableTwo.docx’ the resulting worddocuments are ‘TableOneResult.docx’ and ‘TableTwoResult.docx’. The desired output would have been ‘TableOneCorrect.docx’ and ‘TableTwoCorrect.docx’.
Is there are possibility to achieve this or is it a bug?
Thank you so much in advance.
Best regards