导出EXCEL时出现的问题?急急(路过者有分)在线等
在导出数据到EXCEL里供客户端直接下载时,不论选“打开”“保存”“取消”主程序窗口都回被关闭?请问有谁遇到过类似的问题。
导出代码:
……
sw.Close();
Response.Charset ="GB2312";
Response.AddHeader("Content-Disposition", "attachment; filename="+DateTime.Today.ToString("yyyyMMdd")+new Random(DateTime.Now.Millisecond).Next(10000).ToString()+".xls");
Response.ContentType = "application/ms-excel";
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");
Response.Write(sw);
Response.End();