none
调用Word RRS feed

  • Question

  • 我想在项目中添加一个Word文档help.doc,在点击某个按钮后打开此文档,请问如何添加,如何调用
    • Moved by 紫柔 Tuesday, May 19, 2009 10:38 AM ([Loc]From:.NET Framework 相关)
    Saturday, March 7, 2009 9:21 AM

Answers

All replies

  •  http://support.microsoft.com/kb/304662/zh-cn

    如何使用 WebBrowser 控件在 Visual C# 2005 或 Visual C# .NET 中打开 Office 文档

    也可以使用Dsoframer

    http://support.microsoft.com/kb/311765/zh-cn
    孟宪会
    Sunday, March 8, 2009 2:32 AM
    Moderator
  • 如果使用word打开doc,也可以
    System.Diagnostics.Process.Start("")

    using System.Diagnostics;  
     
    class Program  
    {  
        static void Main()  
        {  
            // A.  
            // Open specified Word file.  
            OpenMicrosoftWord(@"C:\Users\Sam\Documents\Gears.docx");  
        }  
     
        /// <summary>  
        /// Open specified word document.  
        /// </summary>  
        static void OpenMicrosoftWord(string f)  
        {  
            ProcessStartInfo startInfo = new ProcessStartInfo();  
            startInfo.FileName = "WINWORD.EXE";  
            startInfo.Arguments = f;  
            Process.Start(startInfo);  
        }  

    孟宪会
    • Proposed as answer by ericzhou Tuesday, November 13, 2018 1:58 AM
    Sunday, March 8, 2009 2:35 AM
    Moderator
  • 请问我想调用相对路径的docx如何实现呢

    Thursday, March 12, 2009 9:37 AM
  •  OpenMicrosoftWord(Application.ExecutablePath + @"Documents\Gears.docx");
    孟宪会
    Thursday, March 12, 2009 9:51 AM
    Moderator
  • 那我在项目中应该把docx放在哪个文件夹下才能打包到安装程序呢
    Thursday, March 12, 2009 10:49 AM
  • 打包的时候是拷贝这个文件一起放到安装包里,所以放到哪里都一样! 
    周雪峰
    • Marked as answer by 三木燔灼 Thursday, March 12, 2009 1:35 PM
    Thursday, March 12, 2009 1:14 PM
    Moderator
  • WebBrowser好像对于office2000不太支持
    Tuesday, November 13, 2018 12:43 AM