Table Width is Increased | DOCX to PDF Conversion using Java

Aspose Version : 18.9

Issue Description : 1. Whenever the MRC, NRC column value(digits) increases, the currency value wraps inside the cell. (Tables under SERVICE ORDER FORM (OPTIMIZED SERVICES) Heading)
2. To avoid this issue, we have introduced the table auto fit behaviour(AutoFitBehavior.FIXED_COLUMN_WIDTHS)
3. The above fix resolved the wrapping issue in the table cell, but the table width got increased compared to the other tables in the document.
4. When we apply the same style via MS-word, we don’t see this width change in tables.

Note: If we open the word document and save it in the local file system, we don’t encounter the wrapping issue.

Can you please suggest any feasible solutions for this issue.

Attaching the stand alone java project with an input document.


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

As requested, PFA the standalone project. Input and output pdf files are available inside standalone project. Attaching the expected output file separatelyexpected_output.pdf (288.9 KB) (220.5 KB)


Thanks for sharing the detail. We are working over your query and will get back to you soon.


The problematic table has width 532.4 pt. So, its width is greater then other tables. In your case, we suggest you please use the following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");

for (Table table : (Iterable<Table>) doc.getChildNodes(NodeType.TABLE, true)) {
    if(table.getPreferredWidth().getValue() > 100.0)
} + "output.pdf", com.aspose.words.SaveFormat.PDF);

Thank you Tahir. We will try and let you know. Thanks

Hi Tahir,

We have tried to incorporate the above solution in our code. The width is coming correctly. (Even without table Preferred width modification code, the table width is coming fine in the output PDF file.)
Issue statement:

  1. We encountered this table width increase issue only when we apply the table style as AutoFitBehavior.FIXED_COLUMN_WIDTHS.
  2. Above fix has been used for eliminating the Wrapping of Currency value in MRC and NRC columns in the Table.
  3. Without the above fix, we are seeing the wrapping of currency values in the table.

Expected Output:

  1. The issue Table width should have the same width as the previous and next tables in the document. (which is happening in plain PDF conversion as well as MS-word file save as PDF)
  2. The Currency values should not wrap in MRC and NRC columns.(which is happening when we apply FIXED_COLUMN_WIDTHS property to the table via MS-word and save the file as PDF.)

Note: If we open the word document and save it in the local file system, we don’t encounter the wrapping issue.


We tested the scenario using the latest version of Aspose.Words for Java 21.1 and output looks similar to ‘expected_output.pdf’. So, please use Aspose.Words for Java 21.1.

If you still face problem, please ZIP and attach the following resources here for further testing.

  • Your output PDF document generated by Aspose.Words for Java 21.1.
  • Please share the screenshots of problematic sections of output PDF.

We will investigate this issue and provide you more information on it.

Hi Team,
As suggested by you, we have tried out the PDF conversion with the 21.1 version. But we are still seeing the issue in generated PDF.
Please find attached screenshots and source code for your (765.2 KB)


We have logged this problem in our issue tracking system as WORDSNET-21921. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.


Do you have any update on this issue. We are waiting for your reply. Please help to provide solution as soon as possible.


This problem (WORDSNET-21921) actually requires us to implement a new feature in Aspose.Words API and we regret to share with you that the implementation of this issue has been postponed till a later date. However, the fix of this problem may definitely come onto the product roadmap in the future. Unfortunately, we cannot currently promise a resolution date (ETA). We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-21921) have been fixed in this Aspose.Words for Java 22.2 update.