I am trying to export data from database to excel 2007 file.
I just want to change the header of html file to excel 2007 file.
I format the data into a table a
I use this form :
using(System.IO.MemoryStream ms = /*Include Excel File*/) {
ControllerContext.HttpContext.Response.Clear();
ControllerContext.HttpContext.Response.AddHeader("cache-control", "private");
ControllerContext.HttpContext.Response.AddHeader("Content-disposition", "attachment; filename=" + filename + ";");
ControllerContext.HttpContext.Response.AddHeader("Content-type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
ms.WriteTo(ControllerContext.HttpContext.Response.OutputStream);
}
return null;