public ActionResult ExportToExcel()
{
GridView gv = new GridView();
gv.DataSource = db.Details.Select(x => new
{
x.Title,
Category = x.Category.Title,
SubCategory = x.SubCategory.Title,
x.Count,
x.Price,
Automobiles = x.Automobiles.Count,
x.Description
}).ToList();
gv.DataBind();
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=Marklist.xls");
Response.ContentType = "application/ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
return Json(true);
}
出口在当地运作良好。它不适用于Azure。下载一个空文件。告诉我这个问题是什么?
答案 0 :(得分:0)
您的问题可能与最近的Microsoft Microsoft Excel安全更新有关。