首页 > 解决方案 > 如何使用 Office.js 在线读取/写入 Excel Online 和 PowerPoint 中的自定义属性?

问题描述

我们正在为在线办公应用程序开发 Office 插件。寻找 API 以在线读取/写入 Excel 和 PowerPoint 中的自定义属性。

对于在线 Word,可以使用以下方法实现:

function setProperties() {
console.log("Adding custom properties ...");
Word.run(function (context) {
context.document.properties.customProperties.add("TestOBID", "WTDoc:1234");
return context.sync()
.catch(function (e) {
console.log(e.message);
})
})
}

function getProperties() {
console.log("Reading custom properties ...");
Word.run(function (context) {
var customDocProps = context.document.properties.customProperties;
context.load(customDocProps);
return context.sync()
.then(function () {
console.log("No. of custom properties:: " + customDocProps.items.length);
})
})
}

Excel 和 PowerPoint 在线 API 是什么?如果您提供一些示例,将会很有帮助。

标签: office-js

解决方案



推荐阅读