We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert DOCX Word Document to PDF using Java & Preserve Table Cell (Column) Width

We’re generating a word document that has a table. When opening the word document the text in the first column is displayed correctly. When generating a PDF based on this word document the text in the first column is wrapped however. Here’s the code (see the attached example.zip for the relevant files):

Document doc = new Document("input.docx");
doc.updateTableLayout();
doc.save("output.pdf");

Can you take a look please?

example.zip (45.3 KB)

@bmpi,

We have logged this issue in our bug tracking system with ID WORDSNET-20814. Your thread has been linked to this issue and you will be notified here as soon as it will get resolved in future. Sorry for the inconvenience.

@bmpi,

Regarding WORDSNET-20814, we have completed the analysis of this issue but I am afraid, the implementation of the fix of this issue has been postponed till a later date. There are no estimates available at the moment. This issue is blocked by another issue WORDSNET-18661.

The issue occurs because Aspose.Words currently does not calculate table column widths correctly in absence of correct tblGrid data in the document. We have identified multiple issues here.

  1. The document is generated by Aspose.Words. There are actually two adjacent tables represented by w:tblw elements in document.xml. MS Word merges the table into a single one. Aspose.Words treats them as different tables. Aspose.Words does not merge the tables because of different table attributes. The first table has no w:tblLayout element and it is treated as auto-fit table. The second table has w:tblLayout=fixed. Different attributes prevent Aspose.Words from merging the table. A grid calculated for fixed table layout does not match MS Word grid calculation for auto-fit table. In order to resolve the issue, Aspose.Words should merge the tables.

  2. Even if the tables were merged, the current table grid implementation does not support the cell wrapping options specified for some of the cells. There are cells with “don’t wrap text” cell wrapping option and the logic to handle such cells is during grid calculation is not implemented. Also, the table has cells spanning multiple columns and the logic supporting grid re-calculation for that case is not yet released. The required logic is being implemented per WORDSNET-18661.

Both issues should be resolved in order to fix document. We are postponing WORDSNET-20814 until WORDSNET-18661 is resolved

We will inform you via this thread as soon as the linked issue will get resolved in future. We apologize for any inconvenience.