Asp.net mvc IE 8中的XlsSaveOptions(SaveFormat.Excel97To2003)问题

Asp.net mvc IE 8中的XlsSaveOptions(SaveFormat.Excel97To2003)问题,asp.net-mvc,aspose,aspose-cells,Asp.net Mvc,Aspose,Aspose Cells,我正在MVC项目中生成报告。用户可以选择以.pdf格式或.xls格式获取报告 我正在使用Aspose.Cells生成Excel文件。调用下面的ActionResult方法 [HttpGet] public ActionResult GenerateReport(string format, string filterDate = "") { //Processing occurs here to get the appropriate info from Db

我正在MVC项目中生成报告。用户可以选择以.pdf格式或.xls格式获取报告

我正在使用Aspose.Cells生成Excel文件。调用下面的ActionResult方法

    [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);

      return File(fileContents, contentType, "Report");
    }
register.GetReport()仅确定调用的是GetExcelVersion()还是GetPdfVersion()

    private void GetExcelVersion(MemoryStream stream, string name, string dateRequested = "")
    {

      var license = new Aspose.Cells.License();
      license.SetLicense("Aspose.Total.lic");
      var workbook = new Workbook();
      var worksheet = workbook.Worksheets[0];
      var cells = worksheet.Cells;
      //writes out the appropriate information to the excel spreadsheet here           

      workbook.Save(stream, new XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003));
     }
这在Firefox和IE10中非常有用,但在IE8上测试时,我会收到来自Excel的以下警报:-

您试图打开的文件“XXXXX”的格式与文件扩展名指定的格式不同。打开文件之前,请确认文件未损坏且来源可靠。您想现在打开该文件吗?是/否

你知道我做错了什么吗


干杯

正如Saqib Razzaq在上述评论中提到的那样。关闭上述评论中提到的Saqib Razzaq的兼容性模式。如前所述关闭兼容性模式

Excel在发出警告消息后是否最终打开文件?IE8和IE10计算机上的MS Office版本是否相同?Saqib-如果单击“是”提示,则文件将在Excel中打开。MS Office版本与使用IE8和IE10的版本相同。IE8似乎存在问题,许多此类问题出现在谷歌搜索结果中。请你试着关闭兼容模式,就像在工作招待会上建议的那样。非常感谢!Excel是否在发出警告消息后最终打开该文件?IE8和IE10计算机上的MS Office版本是否相同?Saqib-如果单击“是”提示,则文件将在Excel中打开。MS Office版本与使用IE8和IE10的版本相同。IE8似乎存在问题,许多此类问题出现在谷歌搜索结果中。请你试着关闭兼容模式,就像在工作招待会上建议的那样。非常感谢!