We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export xls (multiple sheets) to one html file

Hi, I’m wanting to convert xls to html. I did converted successfully, but I saw that the html file generated converts each xls sheet to a frame in the html document. Is there an option to not use frames but put all the sheets in one html document? Thank you.


Aspose.Cells follows MS Excel standards and specifications in rendering Excel to HTML file format, so by default, it will create folder containing the resource files against worksheets in the workbook. MS Excel does the same when you save the workbook as “Web page” in it manually. But you may still choose the following option/approach to accomplish the task to certain extent and cope with it:

Try to export every worksheet (in the workbook) to individual HTML file and then group all these individual HTMLs to one (final) HTML by yourselves via e.g some tag control or using your own code. In a loop, you may set each sheet active one by one and then render separate HTML file (based on every worksheet) via Aspose.Cells APIs. Please note, when exporting every worksheet to separate HTML, you would need to export image as base64 format (you will use HtmlSaveOptions class here) otherwise it will create folders having resource files. See the sample code for your reference:
Sample code:

//Load your sample workbook
 Workbook wb = new Workbook(“e:\test2\Book1.xlsx”);

 //Specify HtmlSaveOptions
 //Export image as bytes (base 64) as inline images
 //Export active worksheet only
 HtmlSaveOptions opts = new HtmlSaveOptions();
 opts.ExportImagesAsBase64 = true;
 opts.ExportActiveWorksheetOnly = true;//You may activate one sheet at a time.

 //Save the workbook in HTML format with above HtmlSaveOptions
 wb.Save(“e:\test2\out1.html”, opts); 

Hope, this helps a bit.