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

Free Support Forum - aspose.com

Convert xls to html using Aspose.Cells for .NET in C#

Hi

i have been evaluating Aspose Total (for java), i have acquired temporary license. i am working on a Linux machine.

when i convert my xls file to html. the html file gets saved in a directory name followed by a backward slash ("").

for example,
when i do


workbookObj.save("/usr/local/aspose-out/sample.html", FileFormatType.HTML);


it saves in “/usr/local/aspose-out</b>/sample.html” , it automatically creates a directory “aspose-out</b>”.



Could you please tell what is wrong.

regards,
karthikeyan

Hi,

Well, when you save the excel file as .html format, it will generate the main .html file and also creates a source folder having indivudual worksheets data (.htm files etc.) and .css files. We will get back to explain and give you further details soon.

Thank you.

Hi Amjad,

Thanks for you quick response.

The conversion did created the .htm files for the sheets and a css file. my aim is to create a single html output file without frames.
so i remove all the sheets expect the first sheet and then i do the conversion.

regards,
karthikeyan

Hi,

We found the issue on Linux i.e. "aspose-out\". We have fixed it.

Could you try the attached version.

Thank you.

Hi,

thanks for the zip, it works.

does current Aspose Cell (for java) supports .xls to .html with images or charts ?

karthikeyan

Hi,

Sorry, the feature is not supported. We will support it in our future versions soon.

Thank you.

Hi,


Is it possible now to get single html file (all resources embedded) for xls conversion?
Hi Zishan Mohsin,

We do not support exporting Excel file to a single HTML file which includes all resources, such as images, CSS and all document pages as an embedded resources i.e. get a single html file as a result which will contain all resources in it.
Well, you need to implement it by yourself, please export every worksheet one by one using the following sample code (.NET) first (you may easily convert it to Java (if required)), and then combine resultant files by themselves.
e.g
Sample code:

Workbook wb = new Workbook(filePath + "a.xlsx");

HtmlSaveOptions options = new HtmlSaveOptions();

options.ExportActiveWorksheetOnly = true;

options.ExportImagesAsBase64 = true;

int sheetCount = wb.Worksheets.Count;

for (int i = 0; i < sheetCount; i++)

{

wb.Worksheets.ActiveSheetIndex = i;

wb.Save(filePath + "sheet00" + i + ".html", options);

}


Hope, this helps a bit.

Thank you.

Thanks, it works

Hi Zishan Mohsin,


Good to know that the suggested solution is helpful for your needs. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.