Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

HTML, the standard markup language that shapes the structure of webpages, serves as the foundation for online content. Now, with the use of the Syncfusion .NET Word Library (DocIO), you can seamlessly convert HTML to Word documents and Word documents to HTML in C#. Simplify your HTML conversion tasks without installing Microsoft Office on your machine.

Convert HTML to a Word document using C#

This example code shows how to convert HTML to a Word document using the Syncfusion .NET Word Library with just few lines of code in C#.

using Syncfusion.DocIO; 
using Syncfusion.DocIO.DLS; 
//Load an existing HTML file. 
using FileStream inputFileStream = new FileStream("Input.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 
using WordDocument document = new WordDocument(inputFileStream, FormatType.Html); 
//Save the Word document as DOCX format. 
using FileStream outputFileStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite); 
document.Save(outputFileStream, FormatType.Docx);

Key features of HTML-to-Word conversion

Insert HTML snippets

Smoothly integrate HTML snippets into an existing Word document, either at specific positions or by appending them to designated paragraphs, including their formatting.

Customize images

Customize images dynamically during HTML import using the .NET Word Library’s event handler. Effortlessly replace HTML image sources with images from local storage, online platforms, or cloud storage.

Key features of Word-to-HTML conversion

Customize image path

Leverage the event handler to customize image handling during Word-to-HTML conversion. Save images locally or upload them to cloud storage and dynamically set the generated path as the image source in the resulting HTML.

Omit XML declaration

Exclude the XML declaration in the exported HTML file for a lighter and cleaner structure.

Editable fields

Control the export of text form fields by choosing to render them as editable fields or static plain text in the HTML output.

HTML conversion references

Discover resources in our knowledge base that enhance your efficiency in HTML conversions:

How to get images from URLs while opening HTML

Knowledge base

How to get images from URLs while opening HTML in C#

How to save images into a folder and use that path

Knowledge base

How to save images into a folder and use that path in Word-to-HTML conversion

Syncfusion .NET Word Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Frequently Asked Questions

Yes, the .NET Word Library supports conversion to all compatible Word file formats, such as DOC, DOT, DOCX, DOTX, DOCM, and DOTM, as well as XML and RTF.

Yes, the .NET Word Library allows you to convert multiple HTML files into Word documents in one go.

Yes, you can convert HTML containing image URLs into a Word document using this library.

Yes, you can seamlessly insert HTML snippets into a Word document along with rich text formatting like regular Word document content.

Yes, you can save HTML to plain text and Markdown format.

You can access it through the Syncfusion.DocIO.Net.Core NuGet package. Detailed code samples are available in the documentation.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion® reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, View, and edit Word documents in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.

Scroll up icon