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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert HTML to DocX containing images

Thread ID:





149450 Nov 26,2019 10:26 PM UTC Nov 27,2019 01:52 PM UTC ASP.NET Core - EJ 2 1
Tags: DocIO
Tawani Anyangwe
Asked On November 26, 2019 10:26 PM UTC

How to convert HTML to DocX containing images on an ASP.NET Core wenbsite?
How do you set a Base URL
Any support for css classes?

Poorani Rajendran [Syncfusion]
Replied On November 27, 2019 01:52 PM UTC

Hi Tawani,

Thank you for contacting Syncfusion support.

 convert HTML to DocX and set a Base URL:
To meet your requirement, we suggest you to use ImageNodeVisited Event API to convert the HTML file with images to DOCX. We have prepared sample application for the same and it can be downloaded from the below link:

Note: Input HTML files in the “Data” folder of above sample application.

In this sample we have done the following things,
1. Creates a Word document.
2. Hooks the ImageNodeVisited Event to open the image from a specific location
3. Opens an existing HTML file.
4. Saves the Word document.

Please refer our below UG documentation to know more about customize the image data in HTML file

Regarding Any support for css classes:
Currently DocIO doesn’t provide full-fledged support for CSS style sheet in HTML to Word conversion. This feature is to preserve CSS styles while importing HTML files is supported with limited CSS selectors.
The following CSS selectors are supported in Essential DocIO's HTML import functionality at present,
1. IDSelector
2. ClassSelector
3. DescendantSelector
4. ElementSelector
5. ChildSelector

We don’t have any immediate plans to implement this feature. We will let you know when this feature is implemented.

Please let me know if you have any other questions.

Poorani Rajendran.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon