HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.Charset = "GB2312"; this.Page.Response.Write(" ");//解决乱码问题 HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("日常保养记录" + ".xls")); HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); HttpContext.Current.Response.ContentType = "application/ms-excel"; HttpContext.Current.Response.Write(this.outputstr.Value);//写入excel HttpContext.Current.Response.End();