1
votes

I'm trying to build a document with a nested table using insertHtml-Method from documentBuilder in Aspose Words Java (Version 20.12).

When i create a docx file everthing looks fine, but as a pdf the table runs out of the sheet.

My code looks like following:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertHtml("<table border=\"1\" style=\"width: 100%;\"><tbody><tr><td style=\"width: 20%;\">A</td><td><table border=\"1\" style=\"width: 100%;\"><tbody><tr><td style=\"width: 20%;\">1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></tbody></table></td></tr><tr><td>B</td><td>C</td></tr></tbody></table>", true);
doc.updateTableLayout();
doc.save("inner_table.pdf", SaveFormat.PDF);
doc.save("inner_table.docx", SaveFormat.DOCX);

Does anyone knows why this happen? Is it a bug?

1

1 Answers

0
votes

Note that it is normally not recommended to call Document.updateTableLayout() method. In your case, if remove call of this method, the table looks good in both DOCX and PDF output.