MHT to Word csharpMHT to

MHT file contains all resources of a web page including CSS, images, JavaScript, etc. Therefore, you can view the MHT or MHTML files in a browser while offline. In certain cases, you may need to convert an MHT or MHTML file to a Word document. Accordingly, this article covers how to convert an MHT or MHTML file to a Word document in DOCX format programmatically in C#.

MHT to Word Converter – C# API Installation

Aspose.HTML for .NET API can be used to work with different web-related file formats including HTML, MHTML, etc. Simply install the API by downloading its DLL files from the Downloads page or using the following NuGet command:

PM> Install-Package Aspose.Html

Convert MHT or MHTML to Word DOCX File in C#

You can convert an MHT or MHTML file to a DOCX Word document in C# with the steps below:

  1. Initialize an instance of the DocSaveOptions class.
  2. Set the output word document format.
  3. Save the output DOCX file after converting the MHT MHTML file with the ConvertMHTML method.

The code sample below elaborates on how to convert an MHT or MHTML file to a Word document in C#:

Convert MHT or MHTML to Word DOCX with Advanced Options in C#

You can enhance the MHT or MHTML to the Word document conversion process by setting different properties. Please follow the steps below for converting an MHT or MHTML file to a Word file:

  1. Initialize an instance of the DocSaveOptions class.
  2. Set the output document format and specify page dimensions in inches.
  3. Convert the MHT or MHTML to Word file using ConvertMHTML method.

The following code snippet demonstrates how to convert an MHT or MHTML file to a Word document with advanced settings in C#:

Explore Aspose.HTML for .NET API

You may take a look at the documentation space to explore many other features included in the API.

Get Free License

You can evaluate all the features of the API in their full capacity by getting a free temporary license.

Conclusion

In this article, you have learned how to convert an MHT or MHTML webpage to a Word document in DOCX format programmatically in C#. Moreover, advanced conversion to control the page size, resolution, etc. is also supported by the API. Please feel free to contact us at the forum in case of any queries or concerns.

See Also

Download Youku Video Programmatically in C#