繁体   English   中英

Word加载项插入表(JavaScript)

[英]Word Add-in Inserting table (Javascript)

我正在尝试使用JavaScript API为Word 2016编写一个加载项。 该加载项应该具有一个用于插入表格的按钮,但我无法完全正常工作。

Word.run(function (context) {
        // Create a proxy object for the document body.
        var body = context.document.body;

        body.insertTable(2, 2, Word.InsertLocation.end, [["a", "b"], ["c", "d"]]);

        // Synchronize the document state by executing the queued commands, and return a promise to indicate task completion.
        return context.sync();
    }).catch(function (e) {

        console.log(e.message);
    })

这是我必须测试的方法。 每当我激活它时,它都会导致单词挂起一会儿,然后什么也不做。我也已经确保问题与运行该方法的按钮无关。如果有人知道为什么或如何解决它,我会非常感谢。 先感谢您。

我发现问题是因为我使用的word的构建版本不支持inserttable方法,所以更新word是解决该问题的方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM