在新窗口中打开Word文档

时间:2013-10-15 06:09:01

标签: c# ms-word vsto

我一直在编写Microsoft Office Word的加载项。我需要在窗口Word中打开现有文档。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

尝试此代码,如果达到了您的要求,请另外询问。

 public void OpenExistDoc(string docName)
    {
        object fileName = docName;
        object oMissing = Type.Missing;
        this.Application.Documents.Open(ref fileName, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing
            , oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
    }


 private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        this.OpenExistDoc("your file");
    }