
1 HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=CALLINTOTALLIST_Excel.xls"); 2 HttpContext.Current.Response.Charset = "UTF-8"; 3 HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; 4 HttpContext.Current.Response.ContentType = "application/ms-excel"; 5 Gri_CallInRecord.Page.EnableViewState = false; 6 System.IO.StringWriter tw = new System.IO.StringWriter(); 7 System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); 8 Gri_CallInRecord.RenderControl(hw); 9 HttpContext.Current.Response.Write(tw.ToString()); 10 HttpContext.Current.Response.End();
开发语言:c#
开发环境:Win7+VS2008
开发模式:webForm
作用:用于导出GridView的数据,导出文件为Excel