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.
Here is an example of how to convert HTML to Word files in C# using the Syncfusion .NET Word Library (DocIO).
//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.
Leverage .NET Word Library’s event handler to personalize images on the fly while importing HTML. Retrieve images from local storage, online websites, or cloud storage and seamlessly replace HTML image sources.
Here is an example of how to convert a Word document to HTML in C# using the Syncfusion .NET Word Library (DocIO).
//Load an existing Word document.
using FileStream inputFileStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using WordDocument document = new WordDocument(inputFileStream, FormatType.Docx);
//Save as an HTML file.
using FileStream outputFileStream = new FileStream("Result.html", FileMode.Create, FileAccess.ReadWrite);
document.Save(outputFileStream, FormatType.Html);
Utilize the event handler to customize image saving during Word-to-HTML conversion. Use the handler to save images locally or upload them to cloud storage and use the generated path as the image source in the final HTML.
Exclude the XML declaration in the exported HTML file for a lighter and cleaner structure.
Choose between exporting text form fields as editable fields or plain text.
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.