asp.net2.0导出生成word
来源:互联网 发布:java制作软件 编辑:程序博客网 时间:2024/06/07 09:59
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 Default4 : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
}
protected void Button_Click(object sender, EventArgs e)
...{
Object Nothing = System.Reflection.Missing.Value;
//取得Word文件保存路径
object filename = @SaveAs.Text;
//创建一个名为WordApp的组件对象
Word.Application WordApp = new Word.ApplicationClass();
//创建一个名为WordDoc的文档对象
Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//增加一表格
Word.Table table = WordDoc.Tables.Add(WordApp.Selection.Range, 3, 3, ref Nothing, ref Nothing);
//在表格第一单元格中添加自定义的文字内容
table.Cell(1, 1).Range.Text = wordText.Text;
//在文档空白地方添加文字内容
WordDoc.Paragraphs.Last.Range.Text = "Wellcome To Aspxcn.Com";
//将WordDoc文档对象的内容保存为DOC文档
WordDoc.SaveAs(ref filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//关闭WordDoc文档对象
WordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
//关闭WordApp组件对象
WordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
//返回结果
result.Text = "文档路径:<a href='" + SaveAs.Text + "'>" + SaveAs.Text + "</a>(点击链接查看)<br>生成结果:成功!";
}
}
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 Default4 : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
}
protected void Button_Click(object sender, EventArgs e)
...{
Object Nothing = System.Reflection.Missing.Value;
//取得Word文件保存路径
object filename = @SaveAs.Text;
//创建一个名为WordApp的组件对象
Word.Application WordApp = new Word.ApplicationClass();
//创建一个名为WordDoc的文档对象
Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//增加一表格
Word.Table table = WordDoc.Tables.Add(WordApp.Selection.Range, 3, 3, ref Nothing, ref Nothing);
//在表格第一单元格中添加自定义的文字内容
table.Cell(1, 1).Range.Text = wordText.Text;
//在文档空白地方添加文字内容
WordDoc.Paragraphs.Last.Range.Text = "Wellcome To Aspxcn.Com";
//将WordDoc文档对象的内容保存为DOC文档
WordDoc.SaveAs(ref filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//关闭WordDoc文档对象
WordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
//关闭WordApp组件对象
WordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
//返回结果
result.Text = "文档路径:<a href='" + SaveAs.Text + "'>" + SaveAs.Text + "</a>(点击链接查看)<br>生成结果:成功!";
}
}
- asp.net2.0导出生成word
- asp.net2.0导出生成word
- ASP.NET2.0 生成Word 2007并下载方案
- ASP.NET2.0 生成缩略图
- Asp.net2.0实现Word转换Html
- 使用ASP生成/导出WORD文档代码
- ASP.net生成导出WORD文档
- asp.net2.0 利用Dataset,从数据库导出并生成无限级类别的XML文件
- asp.net2.0生成树型结构
- asp.net2.0生成验证码
- asp.net2.0导出pdf文件完美解决方案【月儿原创】
- asp.net2.0导出pdf文件完美解决方案
- asp.net2.0导出pdf文件完美解决方案
- ASP.NET2.0中Gridview中的内容导出到Excel
- ASP.NET2.0中Gridview中的内容导出到Excel
- asp.net2.0导出pdf文件完美解决方案
- ASP.NET2.0中将GridView导出到Excel文件中
- ASP.NET2.0中将GridView导出到Excel文件中
- 解决jsp中文乱码问题
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'value' in class 'com.ving.xzfw.vo.PaymentInfo'
- js_函数大全
- asp.net 获取HTML meta标记中的内容
- sql server 2000启动1069错误(由于登录失败而无法启动服务)
- asp.net2.0导出生成word
- 经典网络小说排行榜
- AppDomain浅析与实例
- 在.NET环境下将报表导出Excel和Word
- NetBeans6.1 下载地址
- 解决eclipse不编译class文件之方法
- 全国哀悼日 建议站点换素装(附代码)
- 马云为灾区捐一元? 阿里巴巴再捐2500万击碎谣言
- 大腕经典台词《DELL XPS 730版》