Hello,
Hi,
Ok. This is example:
Hi,
Thanks for your posting and using Aspose.Cells.
We could partially understand your problem. Please note, if you have not set the license, then you cannot convert any of your worksheet into html because in evaluation mode, the active worksheet will always be an Evaluation Warning worksheet.
However, your problem seems to be different. Could you elaborate your problem by posting us one sample excel file and their expected output html files? It will help us look into your issue more closely and precisely and we will provide you a sample code to achieve the same output as your expected output.
Hello,
Hi,
Thanks for your illustration of the issue and considering Aspose.Cells.
After looking into your output, we found that this can only be achieved by first combining all of your worksheets into a single worksheet and then converting your combined worksheet into html.
Please see the following documentation article that describes how you can combine multiple worksheets into a single worksheet.
( Combine Multiple Worksheets into a Single Worksheet|Documentation )
Ok, Thanks. I will try this solution. But - what will happen when I have different width of columns?
Hi,
Thanks for your posting and considering Aspose.Cells.
That might cause an issue. Because it just combines the contents and do not take care of column widths. So this solution will not work in that case.
Another thing, you can do is to save html of all of your worksheets into memory stream objects and then parse that stream yourself and combine the html contents into a single html document.
But if you like us to add a New Feature request for your issue, then we can log it for product team investigation. It will look into it and implement it if feasible.
Hi,
Thanks for your posting and using Aspose.Cells.
We have found another solution that might fit your needs. You can save your workbook into MHTML format. In this way, you will get a single file that will contain all of your worksheets and everything related to it.
Please see the following sample code that converts your excel file into MHTML format. I have also attached the generated MHTML output file for your reference. Please open it in Internet Explorer or any Web Browser that supports MHTML format.
C#
Workbook wb = new Workbook(dirPath + “workbook.xlsx”);
wb.Save(dirPath + “output.mht”, SaveFormat.MHtml);
Another workaround that you may use is to convert all of your worksheets into images and then add those images in your HTML document via the tag.
The following sample code converts worksheet into image.
C#
//Create a new Workbook object
//Open a template excel file
Workbook book = new Workbook(“C:\Testbook.xls”);
//Get the first worksheet.
Worksheet sheet = book.Worksheets[0];
//Get the second worksheet.
//Worksheet sheet = book.Worksheets[1];
//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
//Specify the image format
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
//If you want entire sheet as a singe image
imgOptions.OnePagePerSheet = true;
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(sheet, imgOptions);
//Render the image for the sheet
Bitmap bitmap = sr.ToImage(0);
//Save the image file
bitmap.Save(@“D:\SheetImage.jpg”);