【发布时间】:2020-04-13 22:27:02
【问题描述】:
我尝试浏览文档,但未能找到有关访问 Office 365 文档的自定义属性的任何信息。我希望能够访问这些属性,以便通过我的 Office 365 插件对它们执行某些操作。
【问题讨论】:
标签: office365 office-js office365api custom-properties
我尝试浏览文档,但未能找到有关访问 Office 365 文档的自定义属性的任何信息。我希望能够访问这些属性,以便通过我的 Office 365 插件对它们执行某些操作。
【问题讨论】:
标签: office365 office-js office365api custom-properties
是的,您可以使用customProperties,即Excel.CustomPropertyCollection 类
这是一个示例代码:
await Excel.run(async (context) => {
let docProperties = context.workbook.properties;
docProperties.load(
"author, lastAuthor, revisionNumber, title, subject, keywords, comments, category, manager, company, creationDate"
);
await context.sync();
console.log("Author: " + docProperties.author);
console.log("Title: " + docProperties.title);
console.log("Subject: " + docProperties.subject);
});
该文档可在以下位置找到: https://docs.microsoft.com/en-us/javascript/api/excel/excel.documentproperties?view=excel-js-preview
【讨论】: