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.
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);
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 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.
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.
Exclude the XML declaration in the exported HTML file for a lighter and cleaner structure.
Control the export of text form fields by choosing to render them as editable fields or static plain text in the HTML output.
Discover resources in our knowledge base that enhance your efficiency in HTML conversions:
Knowledge base
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
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.
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.