Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-excel"; EnableViewState = false; System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(tw); Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("统计.xls", System.Text.Encoding.UTF8)); gvData.RenderControl(hw); Response.Write(tw.ToString()); Response.End();
转载于:https://www.cnblogs.com/PeaCode/p/3868554.html