Table auto fit issues when exporting to pdf


I am building a report using aspose words and trying to get autofit to contents to work and am having issues. The report looks fine when exported to docx, but doesn’t when i export to pdf from aspose.words.


When its off the table looks like this:

When its on the table looks like this:

Each cell has a single paragraph with one run. Each run.text has text and used Aspose.LineFeed to the carriage return.

I have tried to set cell.WrapText = False and that does nothing.

What i am missing?

I am on file version and product version 2014.05.31

I went out and downloaded version and was able to get it to partially work. Now the last column in the row doesn’t autofit and it pushes the table past the page margin.

See attached file for example solution.

Hi Brandon,

Thanks for your inquiry. You are setting the page margins as .5 for Left, Right, Top and Bottom and resizes the table AutoFitToWindow. With these settings, the output document is correct.

Could you please share some more detail about your query which issue you are facing?


That is my mistake. Change the line to AutofitToContent and run again.

You will see the result to look like this -

The page margins are set to half a inch, but the table exceeds the right page margins. It was my understanding that when AutofitToContent the table would size to the content in the table? It doesn’t look like that is happening.

Thank you,


Hi Brandon,

Thanks for sharing the detail. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10656. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-10656) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.