Opening HTML files

Hello:

It would seem that I would be able to open an html file like:

workbook.Open(@"C:\TEMP\Sheet1.htm", FileFormatType.Html);

However, this produces the following error:

Aspose.Cells.CellsException: This file's format is not supported or you don't specify a correct format.

Is there a way to open html files using Aspose.Cells? It can be done in Excel...

Thanks.


This message was posted using Page2Forum from Opening Files - Aspose.Cells for .NET and Java

… I have tried opening simple html files and also html files generated from Excel 2003 and 2007 and none work.

Hi,

Well, I am afraid the feature (Opening/Reading html files) is not supported yet although you can save an excel file (xls, xlsx etc.) as an html file. We support to open/save native excel file formats e.g.., xls, xlsx, spreadsheetml, csv, tab delimited, txt etc. We will look into the feature in our future versions.

Thank you.

Is this feature available now?

Hi KapilJ,


We Do support this feature [reading of HTM files through Aspose.Cells JAVA API] but only for the files that were converted to HTM format using MS Office Excel.

You can try this method by saving any XLS spreadsheet to HTM format (Web Page) using MS Office Excel [I tried with Excel 2010]. You can read this HTM file with below code and can manipulate it as well, before saving it to XLS format.

JAVA
Workbook wb = new Workbook();
wb.open(“C:\temp\book2.htm”);
wb.getWorksheets().getSheet(0).getCells().getCell(“A1”).setValue(“this is another test”);
//If you do not use the second parameter in below save method then the generated file will have HTM extension.
wb.save(“c:\temp\out_test2.xls”, FileFormatType.EXCEL97TO2003);

Attached are the sample input and output files.