【发布时间】:2018-11-22 06:30:45
【问题描述】:
我正在关注这个site来集成office js
这样声明:
import * as Excel from '@microsoft/office-js/excel'
它显示编译时错误:
找不到模块“@microsoft/office-js/excel”
这样声明:
declare var Excel: any
显示运行时错误:
ERROR ReferenceError: Excel 未定义
请建议如何声明它。我需要这样使用它:
Excel.run(session, (context){
...
});
【问题讨论】:
-
一个可能暂时帮助您(直到您找到更好的解决方案)的技巧是声明“Excel”对象,以便规避类型检查。您可以通过添加带有 office.js 的脚本标记并在 javascript 文件中的导入语句下方添加此
declare const Excel: any; declare const Office: any;来做到这一点。 -
已经试过了。没用
标签: angular typescript office-js office-addins office-js-helpers