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

Free Support Forum - aspose.com

Problem fitting an html-table in a word-document

I’m using Aspose.Words to create Word documents from an html-page (rendered aspx-page). De html page contains a table with nested tables. The problem is that I can’t get the table fit on a page in Word. I tried to set the width on the table and table-rows as well as setting properties on the builder-object. I also attached the html-page (as a text-file) which I tried to convert to a Word document.

Thank you for your interest in Aspose.Words.
I have carried out some experiments with your HTML fragment. First I tried changing paper orientation to landscape and the table made fit horizontally. But there are still some strange things with layout and I noted MS Word operates very slowly with the resulting document.
Please check the markup in this fragment. The main table has width = 300px, rows are 400px width and inner tables are 900px width. That’s not good and may be the reason of surprises. The only way to get it working is experimenting with layout. Maybe things could be simplified by changing to one table with merged cells.
Probably you can find a completely different approach in solving your task. You wrote that HTML is a rendered ASPX and you are converting it to a Word document. Note that what is good for displaying in a browser could be less appropriate in a Word document. Consider creating a document template and populating data to it using mail merge, bookmarks or any programmatic techniques. This depends on the form that the source data initially have.
Please feel free to ask further questions or make proposals. We are happy to help you.