将你要输出的内容放在asp:panel标签内,
StringWriter tw =new StringWriter(); HtmlTextWriter hw =new HtmlTextWriter(tw); this.pan_content.RenderControl(hw); System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); response.ContentType ="application/vnd.ms-word"; response.AddHeader("Content-Disposition", "attachment; filename="+ Server.UrlPathEncode(Server.UrlDecode(this.lbtitle.Text) +".doc")); //response.Charset = "utf-8"; response.Write(tw.ToString()); response.End();