Hi,
Our company has purchased Aspose.Cells.
When I have a report which is lesser than or equal to two lines, and i try to convert the report into SpreadSheetML, i get some invalid characters at the end. [CODE: Tag for future reference]
But when i run the same report using the trail version of Aspose, I don’t get any errors. [SAMPLE: Tag for future reference]
Steps:
1. I have backed up my resultant DataTable in my code into an XML file as attached.
2. I assign this DataTable into Spread Sheet Gear Workbook
3. I call the GetStream method which converts the stream of the SSGWorkbook into XML
CODE:
DataTable dt = convertedCellSet.Table;
ssgTemplate.SetCellValue(1, 1, maxRows, maxCols, dt, “Report”);
ssgTemplate.AutoAdjustWidth(new string[] { “Report” });
ssgTemplate.Width(“A”, 35, “Report”);
:::::::::::
XmlDocument dom = new XmlDocument();
MemoryStream stream = template.GetStream(ExcelFileFormat.SpreadsheetML);
StreamReader reader = new StreamReader(stream, false);
reader.BaseStream.Position = 0;
dom = new XmlDocument();
dom.LoadXml(reader.ReadToEnd());
SAMPLE:
DataTable dt = new DataTable();
dt.ReadXml(@“D:\DevApps\Development\FinancialReport\Bin\a.txt”);
ssgWorkbook.Worksheets[sheetName].Range[0, 0, dt.Rows.Count - 1, dt.Columns.Count - 1].CopyFromDataTable(dt, SpreadsheetGear.Data.SetDataFlags.NoColumnHeaders);
::::::::::::
XmlDocument dom = new XmlDocument();
MemoryStream stream = template.GetStream(ExcelFileFormat.SpreadsheetML);
StreamReader reader = new StreamReader(stream, false);
reader.BaseStream.Position = 0;
dom = new XmlDocument();
dom.LoadXml(reader.ReadToEnd());
GETSTREAM code:
Stream stream = workbook.SaveToStream(FileFormat.OpenXMLWorkbook);
Aspose.Cells.Workbook wBook = new Aspose.Cells.Workbook(stream);
if (fileFormat == ExcelFileFormat.SpreadsheetML)
{
wBook.Save(stream, Aspose.Cells.SaveFormat.SpreadsheetML);
}
else if (fileFormat == ExcelFileFormat.HTML)
{
wBook.Save(stream, Aspose.Cells.SaveFormat.Html);
}
The funny thing is, in my CODE output, the HTML output seem to work perfectly fine!!!
I have attached the files in the following order:
1. Data Table output
2. CODE output -> Xml, HTML
3. SAMPLE output -> Xml
Please see the zip file. I am unable to remove a couple of additional attachments using the “Remove” button… Any more bugs in Page???
Please do let me know if you need any more information…
Thanks & Regards,
Anil