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

Free Support Forum - aspose.com

Convert to HTML from Excel (Single File)

I know that it is possible, using Aspose.Cells, to open an Excel file and save it as a HTML file on disk. However this also creates a sub folder with a set of other files in, inc a file for each worksheet in the workbook.

Is there a way to configure the save, to only create a single html file with all of the data in it?

Regards

@gregglinnell,

Thanks for your query.

Well, Aspose.Cells follows MS Excel standards and specifications when rendering to HTML file format. MS Excel too generates resource folder when you render to HTML (Web page). To cope with your issue, you may try the following approaches to cope with your requirements (you may pick one):

Render only single worksheet in the Workbook to HTML file format, it will generate single file (but for one worksheet only) without the resource folder, see the following sample code for your reference:
e.g
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);

You may render images for different worksheets, see the document for your reference:
https://docs.aspose.com/display/cellsnet/Converting+Worksheet+to+Different+Formats

You may render MHtml file instead of HTML, it will render to single Mhtml file with all the resources embedded in it.

Hope, this helps a bit.