We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Convert Word Document with images to HTML

I am attempting to convert a word document, which contains images, to HTML.  The resulting HTML will be used as the body for sending email using System.Net.Mail.SmtpClient. 

I tried this with version 11 and DOCIO was embedding the images as data:image/png;base64.....  The images would not appear in the email, they showed as a red X.  I could save the email as HTML and view the image properly.

I upgraded to the latest version 14 release to see if I could get this working.  When I save the word document to html, I am using the save option to save it to a memory stream.  DOCIO is creating an _images folder that contains the images in the document.  The resulting email cannot show the images since they are not embedded in the email.

I am thinking that the references in the html need to use CID.  I am trying to determine if I will have to do this manually or if this is something that DOCIO can do for me.

Do you have a recommendation or sample that shows how to use DOCIO to convert a document to html and use that to produce an email with embedded images?

Dan

1 Reply

AK Ayswarya Krishna Kumar Syncfusion Team August 29, 2016 12:32 PM UTC

Hi Danny,

Thank you for contacting Syncfusion support.

With the provided details we have determined the working scenario of your requirement. Please find the following steps.
1) Convert the Word document to HTML – using DocIO.
2) The converted HTML string will be given as EMAIL textbody content – using SmtpClient.

We have prepared the sample to meet your requirement and attached the same for your reference. In the sample we have embedded .JPEG images into the HTML file and sent the same HTML content as the mail using LinkedResource of SmtpClient. Try running the sample and let us know whether it helps?

Sample link:
http://www.syncfusion.com/downloads/support/forum/125597/ze/GenerateWord_Windows-810814077.zip

Regards,
Ayswarya


Loader.
Up arrow icon