惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
A
Arctic Wolf
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Troy Hunt's Blog
小众软件
小众软件
L
LangChain Blog
Schneier on Security
Schneier on Security
D
DataBreaches.Net
爱范儿
爱范儿
P
Proofpoint News Feed
博客园 - 聂微东
M
MIT News - Artificial intelligence
Hacker News: Ask HN
Hacker News: Ask HN
T
Tailwind CSS Blog
Vercel News
Vercel News
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
月光博客
月光博客
Spread Privacy
Spread Privacy
C
Cisco Blogs
S
Securelist
量子位
S
Security @ Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tenable Blog
WordPress大学
WordPress大学
T
The Exploit Database - CXSecurity.com
宝玉的分享
宝玉的分享
C
Cybersecurity and Infrastructure Security Agency CISA
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
Help Net Security
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
B
Blog RSS Feed
博客园_首页
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

博客园 - RichardChoi

C# SuperCombox组件 C#农历组件 - 修正版 - RichardChoi C#应用程序控制Excel工作簿操作-基本 对System Analysis and Design的课程设计的一些总结 同学Tomholmes对SAD课程设计的需求分析 System Analysis & Design 课程设计题目(英文) Visual Paradigm试用 - 不错的UML建模和代码生成工具 关于UML建模工具和项目管理工具的问题 NOW VS2005 Beta2 is really on installation process 对于Software Architecture和System Analysis比较的看法 SSITE发放VS2005 Beta2 杂篇(一) 突然醒悟 - 两年前的文章 NETCAFE - 两年前写的 等待.... VS2005 Beta2 VS2005 Beta2新信息 Now Installing VS2005 Beta2 VS2005 Beta2 is coming! 求System Analysis and Design的学习电子书和相关资料
C#应用程序控制Word文档操作-基本
RichardChoi · 2005-05-04 · via 博客园 - RichardChoi

Word.ApplicationClass word=new Microsoft.Office.Interop.Word.ApplicationClass();
   Type wordType=word.GetType();
   Word.Documents docs=word.Documents;

   word.Visible=true;
   // 打开文件
   //Type docsType=docs.GetType();
   //object fileName="c:\\test.doc";
   //Word.Document doc=(Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,docs,new object[]{fileName,true,false});
   //doc.Content.InsertAfter("This is a comment"); // 在文后增加内容
   //MessageBox.Show(this,doc.Content.get_XML(false)); //得到文档的XML

   // 新建文件
   Type docsType=docs.GetType();
   
   object template="c:\\test.dot";
   object newTemplate=Missing.Value;
   object documentType=Missing.Value;
   object visible=true;
   Word.Document doc=(Word.Document)docsType.InvokeMember("Add",System.Reflection.BindingFlags.InvokeMethod,null,docs,new object[]{template,newTemplate,documentType,visible});
   doc.XMLNodes[1].SelectSingleNode("/n:Person/n:Name","xmlns:n='http://tempuri.org/test.xsd'",true).Text=textBox1.Text;
   doc.XMLNodes[1].SelectSingleNode("/n:Person/n:Age","xmlns:n='http://tempuri.org/test.xsd'",true).Text=textBox2.Text;