将asp.net(c#)中textbox的内容导出到word中

来源:百度知道 编辑:UC知道 时间:2024/06/01 18:56:47
将asp.net(c#)中textbox的内容导出到word中,可以是流的方式写入,也可以是添加word组件的方式,但最好的是以流的方式写入

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class EduceDoc : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
this.educeDoc("20090228144600", "application/vnd.doc");
}
private void educeDoc(string FileName, string FileType)
{
//清除反冲区的内容
Response.Clear();
//设置输出流的HTTP字符集
Response.Charset = "gb2312";
//将一个HTTP头添加到输出流
Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.