62,072
社区成员
发帖
与我相关
我的任务
分享
//输出导出结果到客户端
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpContext.Current.Server.UrlEncode(sheetName) + ".xls");
HttpContext.Current.Response.BinaryWrite(File.ReadAllBytes(excelPath));
if (dt.Rows.Count > 10000)
HttpContext.Current.Response.Write("<script language=\"javascript\" type=\"text/javascript\">EndRequest2();</script>");
//删除创建的临时文件
File.Delete(excelPath);