XlsSaveOptions(SaveFormat.Excel97To2003) issue in IE 8

Hello there,

I am generating a report in an MVC project. The user has the option of getting the report in either .pdf format or .xls

I am using Aspose.Cells for the Excel file generation. The ActionResult method below is called.

    [HttpGet]
public ActionResult GenerateReport(string format, string filterDate = “”)
{
//Processing occurs here to get the appropriate info from Db.
var fileFormat = format.ToUpper() == “PDF” ? Format.Pdf : Format.Csv;
var contentType = fileFormat == Format.Pdf ? “application/pdf” : “application/vnd.ms-excel”;
var makePdf = fileFormat == Format.Pdf;
var fileContents = register.GetReport(makePdf, filterDate);
  <span style="color:blue;">return</span> File(fileContents, contentType, <span style="color:#a31515;">"Report"</span>);
}<br><br><font face="Arial">register.GetReport() merely determines if GetExcelVersion() or GetPdfVersion() is called.</font></font><br></pre><pre style="font-family: Consolas; color: black; background: none repeat scroll 0% 0% white;"><font size="2">  <span style="color:blue;">private</span> <span style="color:blue;">void</span> GetExcelVersion(<span style="color:#2b91af;">MemoryStream</span> stream, <span style="color:blue;">string</span> <font size="2">n</font>ame, <span style="color:blue;">string</span> dateRequested = <span style="color:#a31515;">""</span>)

{

<span style="color:blue;">var</span> license = <span style="color:blue;">new</span> Aspose.Cells.<span style="color:#2b91af;">License</span>();
license.SetLicense(<span style="color:#a31515;">"Aspose.Total.lic"</span>);
<span style="color:blue;">var</span> workbook = <span style="color:blue;">new</span> <span style="color:#2b91af;">Workbook</span>();
<span style="color:blue;">var</span> worksheet = workbook.Worksheets[0];
<span style="color:blue;">var</span> cells = worksheet.Cells;

//writes out the appropriate information to the excel spreadsheet here
workbook.Save(stream, new XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003));
}

This works a charm in Firefox and IE10 but when testing on IE8 I receive the following alert from Excel:-

The File you are trying to open ‘XXXXX’, 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? Yes/No

Any ideas on what I am doing wrong?

Cheers!

Hi,


Well, it might be the browser (IE8 ) issue or behavior. Anyways, could you create a simple project (runnable), zip it and post it here to reproduce the issue on our end. We will check it soon. Also please use our latest version i.e. v7.5.0.

By the way, could you try System.IO API or other APIs without involving Aspose.Cells’s APIs to response the file on the client side on IE8 to check if you see the similar behavior or not.

Thank you.