Read write and render MHTML file format in .NET

I have Excel oriented HTML file (.mht format file generated through excel). It had multiple sheets. When I try to load it in workbook I get “This is not a structured storage file.” error message. I can open the same file in Excel without any issues. Could anybody load html file successfully?

Hi,

You can only load HTML file not MHT files. Please see the following code, it loads html file and converts it to xls file.

I have attached the source and output files.

Please use the latest version:
Aspose.Cells for .NET v7.0.3.3


C#


string path = @“C:\Documents and Settings\Home\Desktop\Source And Output Files\Book1.htm”;

Workbook workbook = new Workbook(path);

workbook.Save(path + “.out.xls”);


@parimalbhatt,

Aspose.Cells now supports reading and writing MHTML file format. We recommend to use latest version here:

See the sample code for your reference:
e.g
Sample code:

 var workbook = new Workbook("e:\\test2\\myfile1.mht", new LoadOptions(LoadFormat.MHtml));
            workbook.Save("e:\\test2\\out1.xls");

See the up-to-date Docs for your complete reference:

You may download the featured Examples @ Github repos. here.