Hello,
We have identified a width difference between identical tables inside and outside text box with AUTO_FIT_TO_CONTENTS enabled when exporting to PDF. This works correctly (no visible width difference) when exporting to DOCX. Can you please investigate?
Code snippet:
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
//Insert a table
builder.startTable();
builder.insertCell();
builder.write("Table");
builder.endRow();
builder.endTable();
builder.insertParagraph();
//Insert a text box
Shape shape = new Shape(document, com.aspose.words.ShapeType.TEXT_BOX);
shape.setAnchorLocked(true);
shape.setHeight(100d);
shape.setWidth(100d);
builder.insertNode(shape);
Paragraph paragraph = new Paragraph(document);
shape.appendChild(paragraph);
builder.moveTo(paragraph);
//Insert a table in side the textbox
builder.startTable();
builder.insertCell();
builder.write("Table");
builder.endRow();
builder.endTable();
Table table1 = (Table) document.getChild(NodeType.TABLE, 0, true);
//adding borders seems to highlight and increase the difference between the two tables
table1.setBorders(LineStyle.SINGLE, 3.0, Color.BLACK);
table1.autoFit(AutoFitBehavior.AUTO_FIT_TO_CONTENTS);
Table table2 = (Table) document.getChild(NodeType.TABLE, 1, true);
table2.setBorders(LineStyle.SINGLE, 3.0, Color.BLACK);
table2.autoFit(AutoFitBehavior.AUTO_FIT_TO_CONTENTS);
PDF export:
Aspose.WORDS version: 24.9
Aspose.PDF version: 22.2