Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Mar 30, 2023 6:13 am

Hi,
How to convert HTML with Image Tag to Word File?
I am using the following code.

Document document = new Document();
TextReader tr = new StringReader(ssHTML);
document.LoadHTML(tr, XHTMLValidationType.None);
//Then save the File

Although the file is getting saved, I am not able to see the image.

Thanks!

atalekar
 
Posts: 1
Joined: Tue Mar 14, 2023 12:36 pm

Thu Mar 30, 2023 9:51 am

Hi,

Thanks for your message.
Please refer to the following code to modify it to ensure that you can obtain a Word document containing images.
Code: Select all
//Open an html file.
Document document1 = new Document();   
document1.LoadFromFile("test.html", FileFormat.Html, XHTMLValidationType.None);
//Save it to a Word document.
document1.SaveToFile("HtmlFileToWord.docx", FileFormat.Docx);

If there are any questions after the test, please provide the following information for us to investigate further
1. Your input files as well as your final saved file,which you can upload them here or provide to us by email ([email protected])
2. Your system information (E.g. Win10, 64 bit) and region setting (E.g. China, Chinese).

Best Regards,
Herman
E-iceblue support team
User avatar

Herman.Yan
 
Posts: 115
Joined: Wed Mar 08, 2023 2:00 am

Return to Spire.Doc