protected void Page_Load(object sender, EventArgs e)
{
this.educeDoc("20090228144600", "application/vnd.doc");
}
//导出到word
private void educeDoc(string FileName, string FileType)
{
//清除反冲区的内容
Response.Clear();
//设置输出流的HTTP字符集
Response.Charset = "gb2312";
//将一个HTTP头添加到输出流
Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8) + ".doc");
//设置输出的HTTP MIME类型
Response.ContentType = FileType;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(Session["class"].ToString()+ Session["name"].ToString()+ TextBox1.Text+Session["count"].ToString()+TextBox2.Text);//导出的内容
//把字符数组写入HTTP响应输出流
Response.Write(sb.ToString());
//发送完,关闭
Response.End();
}