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

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
Project Zero
Project Zero
TaoSecurity Blog
TaoSecurity Blog
Cyberwarzone
Cyberwarzone
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AWS News Blog
AWS News Blog
Hacker News: Ask HN
Hacker News: Ask HN
S
Security @ Cisco Blogs
C
Cisco Blogs
Help Net Security
Help Net Security
I
Intezer
W
WeLiveSecurity
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
腾讯CDC
S
Secure Thoughts
MyScale Blog
MyScale Blog
Recorded Future
Recorded Future
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
A
About on SuperTechFans
C
CXSECURITY Database RSS Feed - CXSecurity.com
IT之家
IT之家
J
Java Code Geeks
The Hacker News
The Hacker News
阮一峰的网络日志
阮一峰的网络日志
Scott Helme
Scott Helme
Recent Announcements
Recent Announcements
AI
AI
Cisco Talos Blog
Cisco Talos Blog
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
C
Check Point Blog
Security Latest
Security Latest
S
SegmentFault 最新的问题
T
The Exploit Database - CXSecurity.com
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
PCI Perspectives
PCI Perspectives
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 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;