I am evaluating Aspose.Cells. When I save using FileFormatType.Default it works fine. But if I save using FileFormatType.SpreadsheetML, the resulting file cannot be loaded. The error log is filled with errors such as:
XML ERROR in Table
REASON: Bad Value
FILE: C:\EDS\Workspaces\Development\Projects\FeedbackFileAutomation\FFA_Archive_Dev_001-E920\Feedback_Files\ACP\Location001_qry_20060206.xls
GROUP: Row
TAG: Cell
ATTRIB: StyleID
VALUE: S38
It looks like the styles that are referenced are not defined in the spreadsheet.
Please help. We want the default format for now, but are likely to need other formats down the road. This was the primary reason for picking Aspose for evaluation
Thanks
Could you post your Excel file here? I will check it ASAP.
Thanks I thought I had attached the file - I've tried again
If my attachment attempt fails again, let me know via email and I'll resend it directly
-Reuben Fisher
rfisher@mfs.com
Hi Reuben,
Your attached file is an xml file and it does fail.
Could you post your input Excel template file and sample code to show how you create it? I will check what caused your problem ASAP.
Thank you.
Excel template file ?
I'm not sure what this is?
I thought it was created from scratch from my code.
I've attached the code that produced the file. This code is a single adapter class that writes the Excel file from my application. hiding the Excel implementation details - so I can swap in different Excel writers. This is how I plugged in your product (via constructor dependency injection).
Anyway, to generate the file, you'd need the application that feeds this class its data, which requires our Oracle DB, so I cannot easily give you a standalone example. The adapter class at least shows how I'm using Aspose.
We are currently planning on buying the product but I would like to resolve this issue first.
Also, what would be involved in writing the file as a pdf?
-Reuben Fisher
rfisher@mfs.com
617-954-6148
Thanks for your information. I found the problem and fixed it. Please download and try v3.7.2.
To save file as a pdf, you should use Aspose.Pdf for .NET with Aspose.Cells for .NET.
Excellent - almost
I appreciate the speed with which you diagnosed and posted a fix for the problem. It does now 'sort of' work to save it in XML - but it now has the following new problem, at least I think it's a problem -
If I simply save the file as SpreadsheetML, it works. But, if I save it using Default and then save it a second time as SpreadsheetML, the default file is fine (in Excel format), but the second file has the worksheet that I generated as empty.
I've attached the empty file. It has the worksheet with your evaluation page. But the first worksheet, that I generated, is empty. It is also missing the name I assigned to it.
Here's the code I used to save:
public override void Close()
{
_excelDoc.Save(FilePath, FileFormatType.Default);
String fileName = System.IO.Path.GetFileNameWithoutExtension(FilePath);
String fileMLPath = System.IO.Path.Combine(@"C:\Temp\", fileName+"_ML.xls");
_excelDoc.Save(fileMLPath, FileFormatType.SpreadsheetML);
}
If I reverse the order - save as XML and then as default, I get the same error - the second file also has an empty worksheet.
It seems that previously, I was able to save the file multiple times, in different formats - it just had problems, but the data was there. It seems that wanting to save in more than one format is a reasonable goal.
Should this work? Am I missing something?
Thanks,
Reuben
Hi Reuben,
After calling save method, data in Excel object is reset. To save it again, you can try:
Excel _excelDoc2 = new Excel();
_excelDoc2.Copy(_excelDoc);
_excelDoc.Save(FilePath, FileFormatType.Default);
String fileName = System.IO.Path.GetFileNameWithoutExtension(FilePath);
String fileMLPath = System.IO.Path.Combine(@"C:\Temp\", fileName+"_ML.xls");
_excelDoc2.Save(fileMLPath, FileFormatType.SpreadsheetML);
I will shape the docs. Thank you.