Word to HTML C#

In various cases, you need to display the content of the Word DOCX files in your web or desktop applications. One of the suitable options in such cases is the conversion of DOCX to HTML. To achieve this from within the .NET applications, this article covers how to convert DOCX files to HTML in C#. Moreover, you will learn how to control DOCX to HTML conversion dynamically using different options.

C# DOCX to HTML Converter API - Free Download

To perform DOCX to HTML conversion from within the .NET applications, we will use Aspose.Words for .NET. It is a powerful class library that lets you create and manipulate Word documents. Also, it allows you to convert DOCX documents to various other file formats. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Words 

Convert DOCX to HTML in C#

Aspose.Words for .NET makes it quite easier for you to convert a DOCX document to HTML. Simply load the DOCX document and save it as an HTML file. The following are the steps to convert a DOCX file to HTML in C#.

The following code sample shows how to convert a DOCX to HTML using C#.

C# Customize DOCX to HTML Conversion

Aspose.Words for .NET also allows you to customize the DOCX to HTML conversion using different options. For example, you can specify a folder to keep the resource files (CSS, fonts, and image) separately. In addition, you can export round-trip information of the document. The following sections demonstrate how to use these options.

C# DOCX to HTML - Export Round-trip Information

MS Word provides a wide range of features and not all of these are supported by HTML. Therefore, to make the content of HTML close to the original document, round-trip information is used. The following steps show how to export round-trip information in DOCX to HTML conversion in C#.

The following code sample shows how to export round-trip information in DOCX to HTML conversion in C# .NET.

C# DOCX to HTML Conversion - Specify Resource Folder

While performing DOCX to HTML conversion, you can save the resource files in a separate folder. Also, you can specify folders to keep fonts and images separately. The following are the steps to achieve this.

The following code sample shows how to keep resources in a separate folder in C# DOCX to HTML conversion.

Read more about working with resource folders in DOCX to HTML conversion.

C# API for DOCX to HTML Conversion - Get a Free License

You can get a temporary license in order to use Aspose.Words for .NET without evaluation limitations.

Conclusion

In this article, you have learned how to convert DOCX files to HTML in C#. Furthermore, you have seen how to use different options to customize DOCX to HTML conversion. You can also explore other features of Aspose.Words for .NET using the documentation. In addition, you can post your queries on our forum.

See Also