导出excel 时 只要不用下载工具迅雷直接下载一切正常,但当使用下载工具时导出的EXCEL就为空内容,
导出excel 时,我用这个下载:StringBuilder sb = new StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter(sb);
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
Response.Clear();
Response.Buffer = true; //
Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls");
Response.ContentEncoding = System.Text.Encoding.Default;
Response.ContentType = "application/ms-excel";
dgData.Page.EnableViewState = false;
Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=GB2312\"><title> Copyright by capinfo</title></head><body><center>");
Response.Write(sb.ToString());
Response.Write("</center></body></html>");
Response.End();
只要不用下载工具迅雷直接下载一切正常,但当使用下载工具时导出的EXCEL就为空内容,为什么 --------------------编程问答-------------------- 把Excel导出到服务器端的模板中,再下载就不会出现此情况, --------------------编程问答-------------------- 把迅雷对页面的web监视关掉吧 呵呵~~迅雷这玩意是很恶心
补充:.NET技术 , ASP.NET