当我们的代码在 OWA 之外执行时,Office.onReady() 认为它是 Excel 中的 运行
Office.onReady() thinks it's running in Excel when our code executes outside of the OWA
我们最近更新了 OWA 加载项以使用新的 Office.onReady()
承诺来确保 OfficeJs 已准备就绪。
这也修复了 IE11 在尝试在慢速网络连接上加载 OfficeJs 库时冻结的问题。
这是它的样子:
if (Office !== undefined) {
Office.onReady().then((info: { host: Office.HostType, platform: Office.PlatformType }) => {
console.log(`starting add-in for environment: ${environment.OWA_URL} on host: ${info.host}, platform: ${info.platform}`);
bootStrapAngular();
});
} else {
this.utilService.logMessage(LogLevel.DEBUG, 'Bootstrapping Angular, without OfficeJS');
// FIXME lazy load an OfficeJS mock??
bootStrapAngular();
}
我们发现 - 即使我们应该模拟 Office - 在本地,OfficeJs 似乎认为它在 Excel
中是 运行(不是),在 PC
中(不是) ):
在 OWA 中,打开右窗格:
starting ... on host: Outlook, platform: OfficeOnline
在 OWA 之外,https://localhost:port
:
starting ... on host: Excel, platform: PC
我们可以通过要求主机为 Outlook
且平台为 OfficeOnline
来解决此问题,但这对我来说似乎是一个错误。
是的,这是一个已知问题,团队正在努力修复。
我们最近更新了 OWA 加载项以使用新的 Office.onReady()
承诺来确保 OfficeJs 已准备就绪。
这也修复了 IE11 在尝试在慢速网络连接上加载 OfficeJs 库时冻结的问题。
这是它的样子:
if (Office !== undefined) {
Office.onReady().then((info: { host: Office.HostType, platform: Office.PlatformType }) => {
console.log(`starting add-in for environment: ${environment.OWA_URL} on host: ${info.host}, platform: ${info.platform}`);
bootStrapAngular();
});
} else {
this.utilService.logMessage(LogLevel.DEBUG, 'Bootstrapping Angular, without OfficeJS');
// FIXME lazy load an OfficeJS mock??
bootStrapAngular();
}
我们发现 - 即使我们应该模拟 Office - 在本地,OfficeJs 似乎认为它在 Excel
中是 运行(不是),在 PC
中(不是) ):
在 OWA 中,打开右窗格:
starting ... on host: Outlook, platform: OfficeOnline
在 OWA 之外,https://localhost:port
:
starting ... on host: Excel, platform: PC
我们可以通过要求主机为 Outlook
且平台为 OfficeOnline
来解决此问题,但这对我来说似乎是一个错误。
是的,这是一个已知问题,团队正在努力修复。