Hello, trying to convert some excel files to html (from stream) we obtain a completely blank html: what we can correct?
This is our code (as in your website examples):
Aspose.Cells.HtmlSaveOptions OptionsC = new Aspose.Cells.HtmlSaveOptions();
OptionsC.ExportImagesAsBase64 = true;
((Aspose.Cells.Workbook)m_oDocument).Save(_oOutputStream, OptionsC);
Here they are.
Example attached… but it happened with different excel files of ours
Hi,
Thanks for the template file.
I have tested your scenario/case a bit using the following sample code with your template file, it works fine and the output file (attached) is ok:
e.g
Sample code:
var wb = new Workbook(“e:\test2\GLOSSARI IQTRANSLATE.xlsx”);
var options = new HtmlSaveOptions(SaveFormat.Html)
{
ExportImagesAsBase64 = true,
};
wb.Save("e:\\test2\\out1GLOSSAR1.html", options);
I think since you are saving the Excel file to HTML memory stream which does not allow saving more than one sheet (in the workbook) at a time. I think you should either save your Excel workbook to MHTML file format or try saving different HTMLs for each sheet separately, you got to update/write your code accordingly.
Thank you.
Hi,
I have tested by converting your template file to MHtml file format and it works fine. See the following sample code and find attached the output .mhtml file for your reference:
e.g
Sample code:
var wb = new Workbook(“e:\test2\GLOSSARI IQTRANSLATE.xlsx”);
var options = new HtmlSaveOptions(SaveFormat.MHtml)
{
ExportImagesAsBase64 = true,
};
var stream = new MemoryStream();
wb.Save(stream, options);
string filename = "e:\\test2\\out1.mhtml";
FileStream fstream = new System.IO.FileStream(filename, FileMode.OpenOrCreate);
stream.Position = 0;
byte[] data = stream.ToArray();
fstream.Write(data, 0, data.Length);
And, I am afraid, as I told you in my previous reply that you cannot save to stream having a complete workbook (containing all the worksheets in it) to a single HTML file, you got to save only one worksheet to stream, so you may create separate HTML file for each worksheet in the workbook.
Thank you.
Hi,
BooleServer:
- can you suggest a sample code to save one html (stream) per sheet?
See the sample code for your reference:
e.g
Sample code:
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense("Aspose.Cells.lic");
var wb = new Workbook("e:\\test2\\GLOSSARI IQTRANSLATE.xlsx");
var options = new HtmlSaveOptions(SaveFormat.Html)
{
ExportImagesAsBase64 = true,
ExportActiveWorksheetOnly = true
};
for (int i = 0; i < wb.Worksheets.Count; i++)
{
var stream = new MemoryStream();
wb.Worksheets.ActiveSheetIndex = i;
wb.Save(stream, options);
string filename = "e:\\test2\\out1" + i + ".html";
FileStream fstream = new System.IO.FileStream(filename, FileMode.OpenOrCreate);
stream.Position = 0;
byte[] data = stream.ToArray();
fstream.Write(data, 0, data.Length);
fstream.Close();
stream.Close();
Hope, this helps a bit.
Thank you.