Hello,
We have identified a formatting difference between export to DOCX and PDF when exporting a table with AUTO preferred cell width. Can you please investigate?
Code snippet for the most basic table where this can be reproduced:
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
//Insert a table
builder.startTable();
Cell cell1 = builder.insertCell();
//Add two strings to the firt cell to highlight the new line difference in export
builder.write("test test");
Cell cell2 = builder.insertCell();
//Add a long string to the second cell that forces new line in the first cell
builder.write("AaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaA");
builder.endRow();
builder.endTable();
//Set preferred width to auto for both cells
cell1.getCellFormat().setPreferredWidth(PreferredWidth.AUTO);
cell2.getCellFormat().setPreferredWidth(PreferredWidth.AUTO);
PDF export:
DOCX export:
Aspose.WORDS version: 24.9
Aspose.PDF version: 22.2
@dfinsolutions Unfortunately, I cannot reproduce the problem on my side using the latest 24.12 version of Aspose.Words. Here are output documents generated using the above code on my side:
out.docx (7.3 KB)
out.pdf (15.8 KB)
@alexey.noskov thanks for looking into this. We are still able to reproduce this issue on 24.12, however it looks to be related to OoxmlCompliance option we use when exporting to DOCX. It appears to work incorrectly with ISO_29500_2008_STRICT
and correctly with ISO_29500_2008_TRANSITIONAL
.
@dfinsolutions
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27687
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Can we get an update on this ticket, please?
@dfinsolutions We have completed analyzing the issue, but it is not yet scheduled for development. So we cannot provide you any estimates at the moment. We will be sure to let you know once it is resolved or we have more information for you.
@dfinsolutions Please see attached 27687.zip document that is your case produced document saved to DOC format. If we re-save this ‘neutral’ document using MS Word into transitional/strict DOCX we will get different results and Aspose.Words mimics this logic. This document helps to demonstrate MS Word logic. So Aspose.Words mimics this logic. Do you need Aspose.Words to behave differently than MS Word in this case?
The original issue is that this table is formatted differently when exporting to PDF and DOCX when using ISO_29500_2008_STRICT xml compliance option. Our goal is to have the table look identical across both PDF and DOCX export types. Are you suggesting we should use ISO_29500_2008_TRANSITIONAL to get consistent formatting results?
@dfinsolutions Yes, you can use ISO_29500_2008_TRANSITIONAL
compliance to get the same result as in PDF. MS Word uses different rules for ISO_29500_2008_STRICT
.