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

Free Support Forum - aspose.com

Excel to Html preview Generation without resource folder

Hi,
I am using Aspose.Cells to convert my xlsx file to HTML document. However, I have a requirement that requires only a single HTML document being generated. The issue is that while conversion it generates a resource folder with images, different HTML files. I know we can encode images as base 64. Is there a way to embed all of these files into the main html document.

Thank you.

@diwakarbhatt68,

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):

  1. Render only single worksheet in the Workbook to HTML file format, it will generate single file 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);
    
  2. You may render images for different worksheets, see the document for your reference:
    https://docs.aspose.com/display/cellsnet/Converting+Worksheet+to+Different+Formats

  3. 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.