Hi everyone,
Hi Rui,
Thanks for your posting and using Aspose.Cells.
When you save your workbook into html format in memory stream, then it will not pack everything because resources in html are linked not embedded.
For example, check the attached output html generated by converting the source.xlsx file using the following code.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;
Workbook workbook = new Workbook(filePath);
workbook.Save(filePath + “.out.html”, SaveFormat.Html);
If you check the output html, you will see it has created a folder source.xlsx.out_files which contains all the html resources. These include.
- cellsDrawing_Sheet2_1.png
- cellsDrawing_Sheet3_1.png
- filelist.xml
- image000.jpeg
- image001.jpeg
- image002.jpeg
- sheet001.htm
- sheet002.htm
- sheet003.htm
- stylesheet.css
- tabstrip.htm
All these resources are linked objects not embedded objects.
If you want to get embedded objects, then please save your workbook in MHTML format. Please check the MHTML format generated with the following code which I have attached for your reference. It is a single file which contains all the above resources as embedded objects.
C#
Workbook workbook = new Workbook(filePath);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.MHtml);
ms.Position = 0;
byte[] data = new byte[ms.Length];
ms.Read(data, 0, data.Length);
File.WriteAllBytes("test.mhtml", data);
Hi Shakeel,
Thank you for your explanation that how saving sheets to html works and how to embed those resource files in a webpage using mhtml format. I was wondering if there is an option that we can save sheet to html in a “one-sheet-per-page” behaviour, for example, the result webpage contains several
Hi Rui,
Thanks for your posting and using Aspose.Cells.
You can use Aspose.Cells for GridWeb for this purpose. It will show your Excel file worksheets in separate tabs and fulfill your needs.
I have attached the sample GridWeb project for your reference. Also attached the screenshots illustrating how it displays source Excel workbook sheets in different tabs.
Hi
Shakeel,
Thank you for introduction about GridWeb and it looks great. However as we are using MVC and I was wondering it could be integrated with our project now. Thank you
Hi Rui,
Thanks for your posting and using Aspose.Cells.
We have looked into your requirement and we are afraid, you cannot use GridWeb control in MVC. Please see the following post for your reference.
( Microsoft Office Web Component (OWC) )