ms-office - 使用 Office.js for Office 2013 for Desktop 修改 Office 文档的属性,例如作者
问题描述
我正在使用 office.js 开发 Microsoft Office 插件,针对 Windows 和 Mac。
其中一项要求是修改作者和标签等属性。根据文档主机(Excel、Word 等),特定 API 具有 DocumentProperty 类,可以通过context.document.properties.title
如下所示访问它的属性,
Word.run(function (context) {
var document = context.document;
document.properties.load("author, title");
return context.sync()
.then(function () {
console.log("The author of this document is " + document.properties.author + " and the title is '" + document.properties.title + "'");
});
});
}
来源:stackoverflow,文档
但是这个 API 属于 WordApi 1.3 要求集,即最早支持的版本是 Office 2019。
所以我的问题是 - 有没有办法使用通用 API 或主机特定 API 来执行此操作,这些 API 属于要求集 WordApi 1.1,支持适用于 Windows 的 Office 2013 和适用于 Mac 的 Office 2011 很重要。如果不是,那么确保加载项在最多主机上工作的最接近的解决方案是什么。
解决方案
推荐阅读
- loops - E0597 试图循环一个向量
- webhooks - Spinnaker webhook 阶段不允许超过 5 分钟的超时
- azure - 我可以使用 RBAC 访问 Azure 服务总线中继吗?
- python - 解析时间数据并格式化输出
- mirth - Mirth - EDI/X12 到 EDI/X12 - 只想更改分隔符
- sql - MS Access:玩日期
- javascript - 用于创建 (p5.js) 主体的 for 循环
- go - 如何在 vim 中显示从 go(lang) 包中导入的可能函数/变量
- python - 如何为熊猫布尔掩码中的每个连续真值序列分配唯一的分组值
- python - 将列表名称创建为字符串后如何打印列表?