Hi,
I have a string which is actually a OWC XML file coming into my method as attached (report.xml, FYI).
I am trying to read to convert this string into a stream and convert it into HTML, but i am ending up getting a blank HTML…
Here is my code sample:
// Actual Conversion Function
public String GetHTMLOutput(String spreadSheetXml)
{
StreamReader reader = null;
MemoryStream stream = new MemoryStream();
string htmlData = “”;
try
{
byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(spreadSheetXml);
stream.Read(b, 0, b.Length);
Aspose.Cells.Workbook wBook = new Aspose.Cells.Workbook(stream);
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(ResourceHelper.GetLicenseStream());
wBook.Save(stream, Aspose.Cells.SaveFormat.Html);
reader = new StreamReader(stream);
reader.BaseStream.Position = 0;
htmlData = reader.ReadToEnd();
}
finally
{
if (reader != null)
{
reader.Close();
reader = null;
}
if (stream != null)
{
stream.Close();
stream = null;
}
}
return htmlData;
}
I am ending up getting a blank html document with only styles and no data.
If i do something like:
Aspose.Cells.Workbook wBook = new Aspose.Cells.Workbook(@“Report\Bin\report.xml”, false);
I am able to get the HTML file with some special characters like, ', ‘’ inside them.
But as this code is running on the DMZ, we don’t have the option of creating files, so i have to save it onto Mem Stream and manage the same.
Can you please guide me in solving this problem?
Thanks & Regards,
Anil