Table in table can not display correctly in PDF document

Hi Support,

When create table in table through Aspose.Word library, and save it to Word and PDF documents, the Word looks good, but for PDF, the nested table can not be displayed completely. It should be a defect. Please investigate.

Thanks & regards.

Left: Word
Right: PDF

Sample code:

DocumentBuilder docBuilder = new DocumentBuilder();

// begin table
docBuilder.startTable();
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getRowFormat().clearFormatting();

// 1st Row
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);

// 1st Row - First Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("GUID");

// 1st Row - Second Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("{b2721d73-1db4-4c62-bf78-c548a880142d}");

// End - 1st Row
docBuilder.endRow();

// 3rd Row - First Cell
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("Loc");

Cell cell = docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();

// 3rd row - new table
docBuilder.startTable();

// 3rd row - new table - 1st row
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("Unique ID");

docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("15");

// End - 3rd row - new table - 1st row
docBuilder.endRow();

// 3rd row - new table - 2nt row
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("Doc Pos");

docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("5636");

// End - 3rd row - new table - 2nd row
docBuilder.endRow();

// 3rd row - new table - 3rd row
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("Bookmark");

docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("JLJKLJKL");

// End - 3rd row - new table - 3rd row
docBuilder.endRow();

// End - 3rd row - new table
docBuilder.endTable();

docBuilder.write("Location table");

// End - 3rd Row
docBuilder.endRow();
// 5th Row - First Cell
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("Info");

docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();

// 5th Row - Second Cell - New Table docBuilder.startTable();

// 5th Row - Second Cell - New Table - 1 Row - 1 Cell
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P1");

// 5th Row - Second Cell - New Table - 1 Row - 2 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P2");

// 5th Row - Second Cell - New Table - 1 Row - 3 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P3");

// 5th Row - Second Cell - New Table - 1 Row - 4 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P4");

// End - 5th Row - Second Cell - New Table - 1 Row
docBuilder.endRow();

// 5th Row - Second Cell - New Table - 2 Row - 1 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P11");

// 5th Row - Second Cell - New Table - 2 Row - 2 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P21");

// 5th Row - Second Cell - New Table - 2 Row - 3 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P31");

// 5th Row - Second Cell - New Table - 2 Row - 4 Cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write("P41");

// End - 5th Row - Second Cell - New Table - 1 Row
docBuilder.endRow();

// End - 5th Row - Second Cell - New Table
docBuilder.endTable();

// End - 5th Row
docBuilder.endRow();
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End Table docBuilder.endTable();

docBuilder.getDocument().save("C:\test.doc");
docBuilder.getDocument().save("C:\test.pdf");

Hi
Thanks for your inquiry. Could you please try calling UpdateTableLayout method before saving to PDF (in this case the output PDF looks much better). But you should note, calling UpdateTableLayout can break formatting of other your documents.

docBuilder.getDocument().updateTableLayout();

Best regards,

Just want to double confirm whether calling this method will impact the other parts of PDF document before saving to PDF.

In addition, I wonder if this issue is caused by Table auto to fit to content issue. Please investigate it.

Thanks & regards.

Hi Vincent,
Thanks for your request. Yes, the issues might be related. But we have good news for you. In the next version we will improve support of tables and auto-fit feature. So you can simply wait for the next release and try it on your side. The next version of Aspose.Words will be available at the end of this month.
Best regards,

Can you try it firstly in your side? if it also is reproduciable, we may need to take our next action. Thank you.

I mean you can try to see the auto table content fix can fix this issue also. Thank you.

Hi
Thanks for your request. I verified with new codebase and can confirm that the improvements we made will fix your problem. Please see the attached documents.
Best regards,

Thank for your investigation.

The issues you have found earlier (filed as WORDSNET-2044) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(25)

The issues you have found earlier (filed as WORDSNET-5727) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.