Free Support Forum - aspose.com

Retain Table Column Widths & Dimensions when Saving Word DOC as HTML Fixed File - Java

Hi Aspose,

Using aspose-words 21.5, when document (2).zip (14.9 KB)
is saved as html, the table doesn’t fit on the page anymore.
See included screenshots for the difference between the document viewed in Word and viewed as html.

word.jpg (95.3 KB)
html.jpg (94.4 KB)

Kind regards,
Jan

@inceptionEhv,

We have converted your “BRD-F-1a BS OP-b14-Controle product.doc” to HTML format by using the latest (21.5) version of Aspose.Words for Java and attached it here for your reference. Do you see the same problem in this HTML file?

If yes, then please also share a comparison screenshot (highlighting the problematic areas) here for our reference. Please also share your HTML file showing the undesired behavior here for further testing.

Hi, the table in your html export seems to be a little better.
See html.zip (55.1 KB) for our html export file(s).

In Word the tabel fits on 1 page, in the html file it does not, see 2021-06-01 16_47_20-.png (28.2 KB)

@inceptionEhv,

The “1622558100666_1.html” you shared in previous post is actually in “HTML Fixed” format. We have now converted your “BRD-F-1a BS OP-b14-Controle product.doc” to “HTML Fixed” file format by using the latest (21.5) version of Aspose.Words for Java and attached it here for your reference.

We used the following simple code to produce above HTML Fixed file on our end:

Document doc = new Document("C:\\Temp\\BRD-F-1a BS OP-b14-Controle product.doc");
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions();
doc.save("C:\\Temp\\awjava-21.5 HTML Fixed.html", htmlFixedSaveOptions);

Please make sure that you are using latest (21.5) version of Aspose.Words for Java on your end.

Hi,

Thank you for your time.
We found the reason for the change in layout. Someone had added:

doc.updateTableLayout();

in our code. And this messed up the layout. After removing this line the layout is fine again. It seems the line was added to fix a problem in an earlier version, that does not exist anymore. So all is good now.

Thanks again.

Regards,
Jan

@inceptionEhv,

It is not required to call updateTableLayout method all the time. You can perform conversions without calling updateTableLayout method and still Aspose.Words should produce correct results. In case you have further inquiries or may need any help in future, please let us know by posting a new thread in Aspose.Words’ forum.