我正在使用node.js在本地机器上运行Excel加载项,一切都正常。
在服务器上发布外接程序时,不会执行以下代码:
Office.onReady(info => {
if (info.host === Office.HostType.Excel) {
document.getElementById("sideload-msg").style.display = "none";
document.getElementById("app-body").style.display = "flex";
document.getElementById("run").onclick = run;
}
});
Office.onReady
似乎一直在等待,直到JS API被调用,而这从未发生过。
这与服务器上的node.js安装有关吗?或者问题可能是什么?
感谢您的提问。您能否帮助确认您是否遇到了以下异常,如初始化Office.onReady((中所述
然而,这种做法也有例外。例如,假设您希望在浏览器中打开外接程序(而不是在中侧载Office应用程序(,以便使用浏览器工具调试UI。由于Office.js不会在浏览器中加载,onReady不会运行如果在Office onReady中调用$(document(.ready,它将不会运行。