我不确定是否有人遇到过这个问题。以下是复制问题的步骤。
步骤: 1. 进入列表 --> 联系人页面。2. 单击“导出”按钮为联系人列表生成 .XLS 报告。3. 关闭 .XLS 报告并导航到其他页面,例如联系人列表。4. 在联系人列表中,单击“关闭”按钮重定向回“联系人”列表页面。
预期: - 页面应显示联系人列表页面。
实际: - 显示包含 mojibaki 字符的奇怪页面。请查看此网址中的图片http://i.imgur.com/dIsZc.png
以下是使用活动报告生成 excel 的代码:
私有静态无效 PushContentToHttp(ActiveReport 报告,MemoryStream msData,字符串文件名,字符串 url){
report.Run();
XlsExport xls = new XlsExport();
xls.DisplayGridLines = true;
xls.AutoRowHeight = true;
xls.Export(report.Document, msData);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.AddHeader("Content-Length", msData.Length.ToString());
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename= \"" + fileName + ".xls\"");
HttpContext.Current.Response.AddHeader("Refresh", "3; url=" + url);
HttpContext.Current.Response.Charset = "utf-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252);
//HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250");
HttpContext.Current.Response.BinaryWrite(msData.ToArray());
HttpContext.Current.Response.End();
// HttpContext.Current.Response.Redirect(url,true);
}
任何帮助将不胜感激!太感谢了!:)