请问如何在c#中打开word文件,我现在有word文件的路径?
请高手指点!

解决方案 »

  1.   

    在工程中添加对WORD的引用Word.Document thisDocument = null;
    Word.Application thisApplication = null;//new Word.ApplicationClass();
    CreateWordDocument("c:\temp.doc",ref thisDocument,ref thisApplication);
    thisApplication.ShowMe()
      

  2.   

    Process viewerProcess = new Process();
    viewerProcess.StartInfo.FileName = "C:\Program Files\Microsoft Office\OFFICE11\WinWord.exe";
    viewerProcess.StartInfo.Arguments ="D:\xxx.doc";
    viewerProcess.Start();
      

  3.   

    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()
      
     
    ----------------------------------
    正解
      

  4.   

    请问,怎么在在工程中添加对word的引用?
      

  5.   

    using Microsoft.Office.Interop.Word
    谢谢
    试一试!
      

  6.   

    我试了
    我在工程中添加对WORD的引用,using Microsoft.Office.Interop.Word,但是按上面提供的方法写的方法写的时候,报错为
    "错误 找不到类型或命名空间名称“Word”(是否缺少 using 指令或程序集引用?) "
    是不是我引用错了,麻烦各位再指点指点啊,小弟不胜感激!
      

  7.   

    System.Diagnostics.Process   proc   =   new   System.Diagnostics.Process();   
      proc.EnableRaisingEvents=false;   
      proc.StartInfo.FileName="winword";   
      proc.StartInfo.Arguments="C:\\Dotnetstuff\\TestWordDoc.doc";   
      proc.Start();
      

  8.   

    Microsoft.Office.Interop.Word
    这个dll一般没有安装,可以下载一个
      

  9.   

    我前两天才发贴问过这个问题,现在传给你:
    要引用using Microsoft.Office.Interop.Word,一般人只加了COM组件:Microsoft office 11.0 object library, 应该还要添加Microsoft word 11.0 object library
      

  10.   

    应该还要添加Microsoft word 11.0 object library上面个怎么添加啊?
      

  11.   

    using   Word=Microsoft.Office.Interop.Word
    这样添加就可以了,嘿嘿,但是打开word文档的办法我还没有解决,那个兄弟可以给我一个完整的啊
      

  12.   

    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()这个函数在哪里有啊,我找不到呢