Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=File1.doc");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = "application/ms-word";
divAll.EnableViewState=false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter1 = new System.Web.UI.HtmlTextWriter(oStringWriter);
divAll.RenderControl(oHtmlTextWriter1);
Response.Write("<table border=0 bordercolor='#FFFFFF'><tr><td>"+oStringWriter.ToString()+"</td></tr></table>");
Response.End();
(PS:注意上面的两个DivAll那两个是层的ID.在那个页面上的东西全显示在层里面,他只打印了层里面的东西)