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);
Hi,
Here they are.
Example attached… but it happened with different excel files of ours
Hi,
<span style=“font-size:
10.0pt;font-family:“Courier New”;color:blue;mso-no-proof:yes”>var<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> wb = new Workbook(“e:\test2\GLOSSARI IQTRANSLATE.xlsx”);<o:p></o:p>
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.
- we tried to save as MHTML but the result is not reliable (see attached file)
- can you suggest a sample code to save one html (stream) per sheet?
- in our scenario we must use stream as input and output, so how we can handle excel conversion to html format (with embedded images and all others stuff)?
thanks a lot
Hi,
<span style=“font-size:
10.0pt;font-family:“Courier New”;color:blue;mso-no-proof:yes”>var<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> wb = new Workbook(“e:\test2\GLOSSARI IQTRANSLATE.xlsx”);<o:p></o:p>
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();
<span style=“font-size:10.0pt;line-height:115%;font-family:“Courier New”;
mso-fareast-font-family:“MS Mincho”;mso-fareast-theme-font:minor-fareast;
mso-ansi-language:EN-SG;mso-fareast-language:JA;mso-bidi-language:AR-SA;
mso-no-proof:yes”>
fstream.Write(data, 0, data.Length);
BooleServer:
- can you suggest a sample code to save one html (stream) per sheet?
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();
<span style=“font-size:10.0pt;line-height:115%;font-family:“Courier New”;
mso-fareast-font-family:“MS Mincho”;mso-fareast-theme-font:minor-fareast;
mso-ansi-language:EN-SG;mso-fareast-language:JA;mso-bidi-language:AR-SA;
mso-no-proof:yes”> }