导出excel

原文链接:http://www.cnblogs.com/skywang/archive/2009/12/30/1636387.html             HttpContext.Current.Response.Charset = "UTF-8";
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
            HttpContext.Current.Response.ContentType = "application/ms-excel";
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=aaa.xls");
            //this.tbdata.Page.EnableViewState = false;
            System.IO.StringWriter tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            this.tbdata.RenderControl(hw);
            HttpContext.Current.Response.Write(tw.ToString());
            HttpContext.Current.Response.End();  

转载于:https://www.cnblogs.com/skywang/archive/2009/12/30/1636387.html

上一篇:.Net Core 中使用Session


下一篇:Asp .Net Core 2.0 登录授权以及前后台多用户登录