Converting word to html with images embedded

Hello,
I am trying to convert a word document to html with images embedded in it. (so that i can send the html with email and images are displayed correctly)

How can i do this ?

Currently i use the following code, but the image file is exported to the output folder too as “out.001.png”

Document doc = new Document("c:\temp\general-mail-template.docx"); 
doc.Save("c:\temp\out.html");

Hi Kenan,

Thanks for your inquiry. Please use HtmlSaveOptions.ExportImagesAsBase64 property to save images in Base64 format to HTML. Please use following code example to achieve your requirements and let us know if you have any more queries.

Document doc = new Document(MyDir + "general-mail-template.docx");
HtmlSaveOptions options = new HtmlSaveOptions();
options.ExportImagesAsBase64 = true;
doc.Save(MyDir + "Out.html", options);
1 Like

Thank you very much for your response. I tried and images are embedded succesfully.
However images are still not shown correctly in html message. After some research i found that mail clients generally don’t show embedded images.

So, in order to resolve this issue succesfully, i reverted back to image export functionality while setting an export folder and making that folder publicly accessible in the web server.

Hi Kenan,

Thanks for your feedback. It is nice to hear from you that you have resolved your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Thanks Tahir. I’m exactly looking for this :slight_smile: