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");