javascript - Office Addin Excel 不保存
问题描述
我正在使用 office.js 通过我的 office-addin 与 Excel 进行交互。微软文档说我们可以使用下面的代码保存 Excel,但它一直给我这个控制台错误
TypeError: context.workbook.save is not a function
链接到 Microsoft 文档 - https://docs.microsoft.com/en-us/javascript/api/excel/excel.workbook?view=excel-js-preview#save_saveBehavior _
await Excel.run(async (context) => {
if (Office.context.requirements.isSetSupported('ExcelAPI', '1.11')) {
context.workbook.save(Excel.SaveBehavior.save);
console.log('supported');
} else {
console.log('not supported');
}
})
我尝试了很多,但无法摆脱这个错误。我只是想知道是我做错了什么还是微软文档不正确。请帮忙。
解决方案
ExcelAPI', '1.5' 开始支持保存excel,回调函数尝试结束
return context.sync()
推荐阅读
- javascript - LokiJS 是否支持 ISO-8601 日期格式?
- python - 将基本网址加入到scrapy中的相对网址
- eclipse - 在 Eclipse 中更改 Cmake 生成器
- html - 在相对部分使用多个斜杠解析 URI
- powershell - 如何在没有科学记数法的情况下将长整数转换为字符串
- javascript - 如何更改密码重置电子邮件文本 google firebase
- r - 提取其值包含特定字符串 (R) 的变量名称
- node.js - 快速推送方法不更新 JSON 数据文件
- node.js - 将两个或多个 node.js 需要模块合并到一个命名空间中
- r - R·给地图添加圆形边框