Document with Image saved incorrectly as HTML

With Aspose.Words v9.1

A Word document containing some images is saved with SaveFormat.Html. The floating images are not rendered correctly. They appear in front of the paragraph. The attached sample shows the behaviour.

What can be done for making this work?

Michael G. Schneider

Hello

Thank you for your request. Unfortunately, positioning of floating content is not yet supported by Aspose.Words upon exporting to HTML. Your request has been linked to the appropriate issue. You will be notified as soon as it is supported.
I think the information provided here will be useful for you:
https://docs.aspose.com/words/net/convert-a-document-to-html-mhtml-or-epub/
Best regards,

Hello Andrey,

thanks a lot for the answer. I understand, that “floating images” is no easy subject in general. Anyway, it would be very good, if it were supported. Currently, I need it for saving a Word document to MHTML, for being sent via email.

If there is some workaround, I would like to hear it. Has anybody tried to execute some postprocessing on the generated HTML file? In the cases that I just tested, it would be sufficient to add some style to the img tag. The difficult task might be to find out where to insert the “float: right” style.

Can I tell Aspose.Words to create some structured information, telling what elements were not saved correctly?

Michael G. Schneider

Hello Michael,

Thanks for your inquiry. The only way to work this problem around I can suggest you at the moment is refactoring your document. For example you can try using table layout to create a document. I this case you will be able to control position of each elements inside your document.
Best regards,

Hello Andrey,

thanks a lot for the answer. I already played around with tables. However, I did not quite succeed with it.

The problem is, that the image has to be placed at the right side of the page. If I choose a table layout, the table in the HTM seems to have a fixed width. It would be good, if the table had a “width: 100%” style. Can this be achieved?

Michael G. Schneider

Hello
Thanks for your inquiry. Please try setting “Autofit to Window” for your table, in this case width of table will be 100% in the output HTML.
Best regards,

Hello Andrey,

thanks a lot for the answer. I tried your suggestion. Yes, the total width of the table is then set to 100%.

However, I did not succeed in managing the individual cells’ widths. It seems as if they were always set as percentages of the entire width.

Suppose I want to have a text paragraph with an image floating on the right side. If I want to simulate this with a table, the right cell should have a fixed width. And the left cell should have no explicit width at all, so it takes anything that it can get. With this I did not succeed. There is always some white gap in the middle, being the unfilled area of the right cell.

I really wished, that floating were supported in Aspose.Words exports. Maybe you should concentrate on some easy situations, such as floating on the extreme left or right side. Having some image in the middle of a page, text floating around the top, left, bottom and right side would be really difficult to achieve in HTML. On the other side, a “float: right” seems to be much easier.

Michael G. Schneider

Hi

Thank you for additional information and your suggestion. We will consider supporting floating objects positioning upon exporting HTML. But unfortunately, it is difficult to promise you that this feature will be supported sometime soon.
Best regards.

The issues you have found earlier (filed as 1144) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(19)