操作WORD
来源:互联网 发布:零基础怎么学习seo 编辑:程序博客网 时间:2024/05/01 01:50
object Nothing=System.Reflection.Missing.Value;//调用默认参数
//取得Word文件保存路径
object filename=@tbPath.Text;
//object visible=false;
//创建一个名为WordApp的组件对象
Word.Application WordApp=new Word.ApplicationClass();
//创建一个名为WordDoc的文档对象
object missing = System.Reflection.Missing.Value;
Word.Document WordDoc=WordApp.Documents.Add(ref missing,ref missing,ref missing,ref missing);
//增加一表格
Word.Table table=WordDoc.Tables.Add(WordApp.Selection.Range,1,1,ref Nothing,ref Nothing);
//在表格第一单元格中添加自定义的文字内容
table.Cell(1,1).Range.Text=tbBody.Text;
//在文档空白地方添加文字内容
WordDoc.Paragraphs.Last.Range.Text="欢迎参加.NET学习!";
//将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);
//返回结果
lbResult.Text="文档路径:<a href='"+tbPath.Text+"'>"+tbPath.Text+"</a>(点击链接查看)<br>生成结果:成功!";
- 操作WORD
- Word操作
- 操作word
- word操作
- word 操作
- word操作
- Word操作
- Word 操作
- 操作Word
- VC操作操作Word
- WORD VBA 操作WORD 文本框
- lotusscript操作word文件
- 操作Word的例子
- Java操作Excel,Word
- c# .net 操作word
- word操作大荟萃
- .net操作word
- c#操作word表格
- 教学管理系统-实体Bean
- Linus Torvalds - 1 :Only wimps use ……
- [数据结构复习]字符串1
- VPC安装LINUX后花屏的解决方法(我实验过,可以用的)
- 操作EXCEL(2)
- 操作WORD
- SQL Server 中易混淆的数据类型
- Design pattern learning II: Adapter pattern
- 教学管理系统-待解决的问题
- vmware下安装好ubuntu 6.06(dapper)后安装vmware-tools的方法
- Delphi快捷键
- 关于进程helpsvc.exe这个进程!
- 我的Blog诞生了~
- 发现Tomcat真TM问题多,受不了他的错误机制!