office-js - 如何使用 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 是什么?如果您提供一些示例,将会很有帮助。
解决方案
Excel 的 API 是Excel.CustomProperty和Excel.CustomPropertyCollection。
推荐阅读
- node.js - 当内部函数中抛出错误时,如何使用 Express 将客户端重定向到错误页面?
- javascript - 为什么 dispatcher.resume() 在 ytdl-core 最新版本中停止工作
- drupal-8 - 如何使用 custom_module_form_user_register_form_alter 更改用户配置文件字段的属性?
- python - 在静态方法中使用 globals() 将数据加载到 JSON 文件在类内部不起作用,但在类外部起作用,为什么?
- html - 反应 typeError,useState 不起作用。但我不知道为什么
- google-apps-script - 如何将特定计算外包给另一个 Google 表格以减少计算工作量?
- javascript - Firebase 存储 2-5 个图像的函数,然后 getDownloadURL all URLS => [ ] (array),并设置为反应钩子
- java - 没有form标签中的name/modelAttribute,数据如何从JSP传递到Controller?
- elasticsearch - Logstash 文件输入?
- laravel - Laravel Envoy 到 SSH 进入堡垒服务器,然后,SSH 进入单独的私有 Web 服务器,stdout 被拆分为新行