Office 365 JavaScript API - 获取自定义属性和值的列表。

问题描述 投票:0回答:1

我试图查阅文档,但未能找到任何有关访问 Office 365 文档的自定义属性的信息。我希望能够访问这些属性,以便从我的 Office 365 插件中对它们执行某些操作。

Custom document properties

我找到了这个方法但它似乎只返回文件Url

office365 office-js office365api custom-properties
1个回答
0
投票

是的,您可以使用 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.comen-usjavascriptapiexcelexcel.documentproperties?view=excel-js-preview。

© www.soinside.com 2019 - 2024. All rights reserved.