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

Free Support Forum - aspose.com

Table auto fit issues when exporting to pdf

Hello,


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.

table.AutoFit(Aspose.Words.Tables.AutoFitBehavior.AutoFitToContents)
When its off the table looks like this: https://shareitsimple.com/Shares/Retrieve/23c48ff8-a3f0-4014-ab49-0cf83d17d7d4

When its on the table looks like this: https://shareitsimple.com/Shares/Retrieve/ae31c227-b823-4faf-8ee0-135030b405c8

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 14.5.0.0 and product version 2014.05.31

I went out and downloaded 14.7.0.0 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?

Hello,


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

You will see the result to look like this - https://shareitsimple.com/Shares/Retrieve/0b93563a-c8b0-4572-a3e6-ad6b87f60c69

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,
Brandon

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.