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

Free Support Forum - aspose.com

Set Fixed Column Cell Width or AutoFit Tables in Word Document to Content or Window using Java

I used “fontchanger” to enlarge the text of the cell, but the width of the cell was not adjusted accordingly, resulting in only half of the enlarged font. I used many methods to try to solve it, but it didn’t work very well. Of course, I set the width of the page is also a small part of the reason.

2、 table.setPreferredWidth(PreferredWidth.fromPercent(100));

How can I solve this problem? Thank you
InkedScreenshot_2020-04-03-17-33-47-77_841797baea012d5_LI.jpg (210.4 KB)
表格2.zip (28.8 KB)


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

  • Your simplified input Word document
  • Aspose.Words 20.3 generated output DOCX file showing the undesired behavior
  • Your expected DOCX file showing the desired output. You can create this document by using MS Word. Please also list the complete steps that you performed in MS Word to create the expected document on your end

As soon as you get these pieces of information ready, we will start investigation into your scenario and provide you code to achieve the same by using Aspose.Words API. Thanks for your cooperation.