JNA / MS Word转到Word文档中的书签

时间:2016-06-28 00:09:58

标签: jna

我正在使用MSOfficeDemo/MSWord类。

我已为MSWord gotoBookmark(String bm)添加了一种新方法。

我已经检查了{done} ComLateBindingObject,下面的4个电话是最有可能的候选人。 以下是我在invokeNoReply()方法中尝试过的gotoBookmark()来电。但是,他们正在回归我所描述的错误 书签确实存在于文档中。

    LONG lTypeBookmark = new LONG(-1);
    LONG lCount        = new LONG(1);
    LONG lInstanceOne  = new LONG(1);

    VARIANT[] args = new VARIANT[4];
    args[0] = new VARIANT(lTypeBookmark);
    args[1] = new VARIANT(lInstanceOne);
    args[2] = new VARIANT(lCount);
    args[3] = new VARIANT("TestBookmark");

    // This is from another method (insertText()) in the MSWord class that seems to work well.
    Selection pSelection = new Selection(this.getAutomationProperty("Selection", this.getIDispatch()));

    // 1.
    // Error returned: You entered multiple destinations for a page, line,     footnote, endnote, or comment.
    this.invokeNoReply("GoTo", this.getActiveDocument().getIDispatch(), args);

    // 2.
    // Error returned: You entered multiple destinations for a page, line, footnote, endnote, or comment.
    this.invokeNoReply("GoTo", pSelection.getIDispatch(), args);


    // 3.        
    // Error returned : Bad parameter.
    this.invokeNoReply("GoTo", pSelection, vtTypeBookmark, vtBookmarkName);

    // 4.  
    // Error retuned: Bad parameter.
    this.invokeNoReply("GoTo", pSelection, vtBookmarkName);

0 个答案:

没有答案
相关问题