我正在尝试使用javascript api为word2016编写一个插件。这个插件应该有一个插入表的按钮,但我不能让它工作。
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挂起片刻,然后什么也不做。我也已经确保这个问题与运行方法.If的按钮无关。任何人知道为什么或如何修复它,我都会非常感激。提前谢谢你。
发布于 2017-03-29 17:08:16
我发现这个问题是因为我使用的word的构建版本不支持inserttable方法,所以更新word就是解决这个问题的方法
https://stackoverflow.com/questions/43044817
复制相似问题