This project has moved. For the latest updates, please go here.

Opening XLSX from Internet explorer says "File is corrupted and cannot be opened"

Jun 15, 2012 at 12:43 PM

Hello there,

I have a small issue, the thig is that when i open the file directly from IE9 it gives me this message in office 2010. I have noticed that in your demo it does not do the same, and i wish if you had the time to see if i am doing something wrong or is it a bug.

If i use firefox the file opens just fine, if i save the file first then open it will also work fine and if i turn off protected view in excel(something i really do not want to do) it also works. I`ve googled for many hours, yet no one knows why. I am bothering you because in your demo OpenXml opens just fine(xlsx) opens just fine, so you may hold the key. I am using ASP.NET MVC3 with IIS Express.

public ActionResult DownloadRfe(int id)
 List<Cost> costs = _reportBl.UserCostsById(id);
 Report report = new Report(costs.ToReportSource());
 ExcelReportWriter ex = new ExcelReportWriter();
 return new ReportResult(report, ex) { FileName = "report.xlsx" };

Also in my adress i do not use ".xlsx" at the end because i have to pass an id and it does download my file this way to.

Cheers, Freeman.