Free Support Forum - aspose.com

Some tables broken since 10.5

Hello,

since the new release I’ve some broken tables.
The first 3 tables in my document look good (Good.png) the following tables all look strange. At first they took only about 2cm of width in my document. I then added table.setPreferredWidth(PreferredWidth.fromPoints(pageWidth));

Now they’re looking like you can see in attatchment (Bad.png).

What am I doing wrong. Please help!!

Kind regards

Hi

Thanks for your request. Could you please attach your documents and sample code that will allow us to reproduce the problem? We will check the issue and provide you more information.

Best regards,

Hi there,


Thanks for your inquiry.

Most likely your tables appear different because by default tables are now auto fitted to the window. To revert this behaviour you can set autofit to fixed column widths. Please see the code below.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Table<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> table =
builder.StartTable();<o:p></o:p>

builder.InsertCell();

table.AutoFit(AutoFitBehavior.FixedColumnWidths);


If you have any further troubles could you please attach your template here for testing?

Thanks,

Ok that looks good so far. Thanks.

But can you tell me what’s the difference between table.setAllowAutoFit(boolean) and table.autoFit(AutoFitBehavior)

What’s the difference between these two?

Kind regards,
Jan

Hi

Thanks for your request. table.setAllowAutoFit(boolean) simply sets or resets “Allow Auto Fit” option of the table. table.autoFit(AutoFitBehavior) adjusts width of columns in the table according to the specified AutoFitBehavior.

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/table.html#autoFit(int)

Best regards,