ASP.NET导出Excel文件问题,导出后表里没内容
我用以下方法做的导出,为什么导出的Excel文件没有内容?谢谢大家帮个忙
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer= true;
HttpContext.Current.Response.Charset="utf-8";
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=会员消费汇总表.xls");
HttpContext.Current.Response.ContentEncoding=System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.rpResult.RenderControl(oHtmlTextWriter);
HttpContext.Current.Response.Write(oStringWriter.ToString());
HttpContext.Current.Response.End();