我想获取当前活动文档信息/文本,用户可以在屏幕上看到。 我们可以通过Word JS API 来实现吗?或者有没有其他方法可以获取 JS Addins 的当前/活动页面。
我认为无法获取当前/活动页面
selection
Word.run(function (context) {
// Get the currently active document.
var document = context.document;
// Load the body of the document to access its text.
var body = document.body;
body.load("text");
return context.sync().then(function () {
// Access the text of the document's body.
var text = body.text;
// Do something with the text.
console.log("Text from the active document: " + text);
});
}).catch(function (error) {
console.log(error);
});