在显示页面我通过重定向到打印页面:Server.Transfer("PrintPage.aspx");然后在打印页面中通过ExpertControl(this, DocumentType.Word);方法导出到WORD:
public void ExpertControl(System.Web.UI.Control source, DocumentType type) {
//设置Http的头信息,编码格式
if (type == DocumentType.Excel)
{
//Excel
Response.AppendHeader("Content-Disposition","attachment;filename="+lblProjectName.Text +".xls");
Response.ContentType = "application/ms-excel";
}
else if (type == DocumentType.Word)
{
//Word

if (this.lblPrjBianHao.Text=="")
{
Response.AppendHeader("Content-Disposition","attachment;filename="+this.lblProjectName.Text+".doc");
}
else
{
Response.AppendHeader("Content-Disposition","attachment;filename="+this.lblPrjBianHao.Text+"."+this.lblProjectName.Text+".doc");
}
Response.ContentType = "application/ms-word";
}
Response.Charset = "utf-8";   
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
//关闭控件的视图状态
source.Page.EnableViewState =false;   
//初始化HtmlWriter
System.IO.StringWriter writer = new System.IO.StringWriter() ;
System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
source.RenderControl(htmlWriter);
//输出
Response.Write(writer.ToString());
Response.End();
}因为导出的某些WORD文件不只一页,所以要求在页脚自动加上打印日期及第几页/总页数,请知道的人帮帮我,谢谢!