Our client has asked us to make sure all our excel sheets that we generate are readable by Excel 2003 onwards. We are using this code to save out the spreadsheet,
public byte GetAsByteArray()
System.IO.MemoryStream myMemoryStream = new System.IO.MemoryStream();
contentGuide.Save(myMemoryStream, new XlsbSaveOptions(SaveFormat.Excel97To2003));
byte contentasByteArray = myMemoryStream.ToArray();
catch (Exception e)
throw new Exception (“Unable to convert the Aspose Workbook to a byte array for storage in DB”, e);
This is written to our database. When we write the file out and send it out, we are still getting the error, "The file you are trying to open, ‘FileName_7857386_120119.xls’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"
The client really wants us to get rid of this error message. What are we doing wrong? If I open this file and do Save As, I would have expected the “Save As Type” to be Excel 97-2003 but its actually set to Excel Binary Workbook (*.xlsb). Maybe this is a red herring but could it point to us saving it into the database incorrectly or out of the database?
Any ideas gratefully received