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

How to convert HTML to DocX containing images

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?

1 Reply

PR Poorani Rajendran Syncfusion Team November 27, 2019 01:52 PM UTC

Hi Tawani,


Thank you for contacting Syncfusion support.


Regarding
 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:
https://www.syncfusion.com/downloads/support/forum/149450/ze/CreateWordSample1613687

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
https://help.syncfusion.com/file-formats/docio/html?cs-save-lang=1&cs-lang=asp.net%20core#customize-image-data

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.


Regards,
Poorani Rajendran.

 


Loader.
Up arrow icon