Free Support Forum -

How can I convert word to html with this img?

In the example below, after I use word to convert to html, the path of the image carries http, and this path has expired, how can I successfully display it?

This is my code
Document doc = new Document(“1.docx”);
HtmlSaveOptions nop = new HtmlSaveOptions();
nop.setCssStyleSheetType(CssStyleSheetType.EMBEDDED);“2.html”, nop);

Thanks very (14.0 KB)


What do you mean by ‘path has expired’? Can you please elaborate your query further by providing complete details of your usecase and problem statement?

To put it another way, I use this code to convert this document to html, how can I display the image correctly?


If you do not use ‘HtmlSaveOptions.ExportImagesAsBase64’ property, then Aspose.Words will save the image on disk and set the path of ‘src’ attribute of ‘img’ tag accordingly.

However, if you specify nop.setExportImagesAsBase64(true);, then there will be no path specified in ‘src’ attribute of ‘img’ tag. It will contain embedded data of image in Base64 format. And image will not be saved on disk either. Hope, this helps.

I understand this.But why the path of ‘src’ attribute of this image in ‘1.docx’ can not covert to base64 after I use HtmlSaveOptions.ExportImagesAsBase64


For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSJAVA-1936. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-1936) have been fixed in this Aspose.Words for .NET 18.12 update and this Aspose.Words for Java 18.12 update.