请高手指点:c#中如何打开word文档? 请问如何在c#中打开word文件,我现在有word文件的路径?请高手指点! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在工程中添加对WORD的引用Word.Document thisDocument = null;Word.Application thisApplication = null;//new Word.ApplicationClass();CreateWordDocument("c:\temp.doc",ref thisDocument,ref thisApplication);thisApplication.ShowMe() Process viewerProcess = new Process();viewerProcess.StartInfo.FileName = "C:\Program Files\Microsoft Office\OFFICE11\WinWord.exe";viewerProcess.StartInfo.Arguments ="D:\xxx.doc";viewerProcess.Start(); hertcloud(·£孙子兵法£·) ( ) 信誉:100 Blog 2007-03-29 11:39:08 得分: 0 在工程中添加对WORD的引用Word.Document thisDocument = null;Word.Application thisApplication = null;//new Word.ApplicationClass();CreateWordDocument("c:\temp.doc",ref thisDocument,ref thisApplication);thisApplication.ShowMe() ----------------------------------正解 请问,怎么在在工程中添加对word的引用? using Microsoft.Office.Interop.Word谢谢试一试! 我试了我在工程中添加对WORD的引用,using Microsoft.Office.Interop.Word,但是按上面提供的方法写的方法写的时候,报错为"错误 找不到类型或命名空间名称“Word”(是否缺少 using 指令或程序集引用?) "是不是我引用错了,麻烦各位再指点指点啊,小弟不胜感激! System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; proc.StartInfo.FileName="winword"; proc.StartInfo.Arguments="C:\\Dotnetstuff\\TestWordDoc.doc"; proc.Start(); Microsoft.Office.Interop.Word这个dll一般没有安装,可以下载一个 我前两天才发贴问过这个问题,现在传给你:要引用using Microsoft.Office.Interop.Word,一般人只加了COM组件:Microsoft office 11.0 object library, 应该还要添加Microsoft word 11.0 object library 应该还要添加Microsoft word 11.0 object library上面个怎么添加啊? using Word=Microsoft.Office.Interop.Word这样添加就可以了,嘿嘿,但是打开word文档的办法我还没有解决,那个兄弟可以给我一个完整的啊 System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; proc.StartInfo.FileName= "winword "; proc.StartInfo.Arguments= "C:\\Dotnetstuff\\TestWordDoc.doc "; proc.Start();这个可以打开但是是用WORD 打开,不是在WINFORM 里面打开,还有Word.Document thisDocument = null; Word.Application thisApplication = null;//new Word.ApplicationClass(); CreateWordDocument( "c:\temp.doc ",ref thisDocument,ref thisApplication); thisApplication.ShowMe() 里面的CreateWordDocument()这个函数在哪里有啊,我找不到呢 必须声明标量变量 "@**"的疑难问题! C#怎么截取Textbox里的前两个中文字 怎样利用反射遍历一个类的所有枚举? winform中怎样终止一个程序的运行(急) C#中切字符串,求一个可以切字符串的方法. 弹出的form2窗口,位置怎么不听使唤呢 多线程流水线模式的问题???????????????????? 急!!(在线等待)在C#窗口中自动产生组织结构图. DataGrid的打印!!! 一个关于自定义打印纸张的问题 大家用的是什么样的SQLHelper? 如何得到进程打开的事件
Word.Application thisApplication = null;//new Word.ApplicationClass();
CreateWordDocument("c:\temp.doc",ref thisDocument,ref thisApplication);
thisApplication.ShowMe()
viewerProcess.StartInfo.FileName = "C:\Program Files\Microsoft Office\OFFICE11\WinWord.exe";
viewerProcess.StartInfo.Arguments ="D:\xxx.doc";
viewerProcess.Start();
在工程中添加对WORD的引用Word.Document thisDocument = null;
Word.Application thisApplication = null;//new Word.ApplicationClass();
CreateWordDocument("c:\temp.doc",ref thisDocument,ref thisApplication);
thisApplication.ShowMe()
----------------------------------
正解
谢谢
试一试!
我在工程中添加对WORD的引用,using Microsoft.Office.Interop.Word,但是按上面提供的方法写的方法写的时候,报错为
"错误 找不到类型或命名空间名称“Word”(是否缺少 using 指令或程序集引用?) "
是不是我引用错了,麻烦各位再指点指点啊,小弟不胜感激!
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="winword";
proc.StartInfo.Arguments="C:\\Dotnetstuff\\TestWordDoc.doc";
proc.Start();
这个dll一般没有安装,可以下载一个
要引用using Microsoft.Office.Interop.Word,一般人只加了COM组件:Microsoft office 11.0 object library, 应该还要添加Microsoft word 11.0 object library
这样添加就可以了,嘿嘿,但是打开word文档的办法我还没有解决,那个兄弟可以给我一个完整的啊
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName= "winword ";
proc.StartInfo.Arguments= "C:\\Dotnetstuff\\TestWordDoc.doc ";
proc.Start();
这个可以打开但是是用WORD 打开,不是在WINFORM 里面打开,
还有
Word.Document thisDocument = null;
Word.Application thisApplication = null;//new Word.ApplicationClass();
CreateWordDocument( "c:\temp.doc ",ref thisDocument,ref thisApplication);
thisApplication.ShowMe()
里面的
CreateWordDocument()这个函数在哪里有啊,我找不到呢