Excel外接程序ribbon单击XMLHttpRequest: Network Error 0x800c0019,访问



我使用office.js, javascript, react等创建了excel插件。我已经创建了ribbon,想要有条件地启用禁用ribbon菜单。我创建的代码和清单在chrome和edge上运行良好,但在IE和桌面浏览器上运行不了。在IE/桌面excel发现错误在控制台点击功能区菜单。XMLHttpRequest: Network Error 0x800c0019,访问该资源所需的安全证书无效。

按照链接中的建议创建了功能区:excel-shared-runtime-scenario。在read me部分的这个链接中提到了"插件需要HTTPS网站。请运行npx office-add -dev-certs install——days 365安装开发证书。因此,当我安装此证书时,此链接中的给定示例可以正常工作。

但是这个证书我不能在我自己的本地开发中使用。请帮忙理解我是否需要为此创建证书?如果是,我怎么能创建它,因为我是新的office.js。如果我需要在Azure环境中移动此代码该怎么办?我如何在Azure上移动此证书。

PSB section from manifest:

<Group id="LoginGroup">
<Label resid="LoginGroup.Label"/>
<Icon>
<bt:Image size="16" resid="LGButton.Icon"/>
<bt:Image size="32" resid="LGButton.Icon"/>
<bt:Image size="80" resid="LGButton.Icon"/>
</Icon>
<Control xsi:type="Button" id="BtnLoginService">
<Label resid="BtnLoginService.Label" />
<Supertip>
<!-- ToolTip title. resid must point to a ShortString resource. -->
<Title resid="BtnLoginService.Label" />
<!-- ToolTip description. resid must point to a LongString resource. -->
<Description resid="BtnLoginService.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="LGButton.Icon"/>
<bt:Image size="32" resid="LGButton.Icon"/>
<bt:Image size="80" resid="LGButton.Icon"/>
</Icon>
<!-- This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFunction or ShowTaskpane. -->
<Action xsi:type="ExecuteFunction">
<FunctionName>btnloginservice</FunctionName>
</Action>
</Control>
<Control xsi:type="Button" id="BtnLogoutService">
<Label resid="BtnLogoutService.Label" />
<Supertip>
<!-- ToolTip title. resid must point to a ShortString resource. -->
<Title resid="BtnLogoutService.Label" />
<!-- ToolTip description. resid must point to a LongString resource. -->
<Description resid="BtnLogoutService.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="SignOutButton.Icon"/>
<bt:Image size="32" resid="SignOutButton.Icon"/>
<bt:Image size="80" resid="SignOutButton.Icon"/>
</Icon>
<!-- This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFunction or ShowTaskpane. -->
<Action xsi:type="ExecuteFunction">
<FunctionName>btnlogoutservice</FunctionName>
</Action>
<Enabled>false</Enabled>
</Control>
</Group>

Command.js代码:

export function btnloginservice(event) {
console.log('Open login dialog');
g.state.isMenuEnabled = true;
updateRibbon();
enableButton();
SetRuntimeVisibleHelper(true);
event.completed();
}
export function btnlogoutservice(event) {
console.log('Open login dialog');
g.state.isMenuEnabled = false;
updateRibbon();
btnCloseTaskpane(event);
}

我在这里完全被阻塞了。谢谢你的帮助。提前感谢。

Office插件是一个web应用程序。除非微软的文档另有说明,否则您可以按照与其他web应用程序相同的方式进行操作。在互联网上搜索如何在web应用程序中获取和使用HTTPS证书的信息。

同样,可以在您自己的本地开发中使用npx命令生成的证书。它不仅限于样本。

相关内容

最新更新