在 Excel 之外的浏览器中从 Ribbon 中的按钮直接打开网页? [英] Open directly a web page from a button in Ribbon in a browser outside Excel?

查看:51
本文介绍了在 Excel 之外的浏览器中从 Ribbon 中的按钮直接打开网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 AppSource 中有几个 Excel 插件.目前,我们在功能区中有一个用于 Documentation 的按钮,单击该按钮可在 Excel 的任务窗格中打开文档网页.

We have several Excel add-ins in AppSource. At the moment, we have a button in Ribbon for Documentation, clicking on the button opens the documentation webpage in a taskpane in Excel.

我们觉得由于任务面板很小,人们不太可能阅读那里的文档.因此,更好的方法是在 Excel 之外的浏览器中打开文档网页.

We feel that as the taskpane is small, people are unlikely to read documentation over there. So a better way would be to open the documentation webpage in a browser outside Excel.

我们注意到在 Script Lab 中,点击 Reference Docs 会打开一个小窗口,其中包含 在新窗口中打开链接.然后,我们需要点击该链接以最终在浏览器中打开它:

We notice that in Script Lab, clicking on the Reference Docs opens a small window which contains open link in new window. Then, we need to click on that link to finally open that in a browser:

https://user-images.githubusercontent.com/774409/81099107-ab068e80-8f0a-11ea-9633-eba5c1e42f90.png

那么我们必须要有这个中间窗口吗?我们不能在 Excel 之外的浏览器中通过 Ribbon 中的按钮直接打开网页吗?

So do we have to have this intermediate window? Cannot we open directly a web page from a button in Ribbon in a browser outside Excel?

PS:我不想用Dialog API来显示文档,因为Dialog窗口打开的时候好像不能同时使用Excel?

PS: I don't want to use Dialog API to show documentation, because it seems that when the Dialog window is open, we cannot use Excel at the same time?

推荐答案

在清单中,您可以减少 UI,并指定加载项通过执行 JavaScript 的加载项命令公开的操作的源代码文件功能而不是显示 UI,

In manifest, you could make it UI less, and specifies the source code file for operations that an add-in exposes through add-in commands that execute a JavaScript function instead of displaying UI,

<DesktopFormFactor>
  <FunctionFile resid="residDesktopFuncUrl" />
  <ExtensionPoint xsi:type="PrimaryCommandSurface">
    <!-- information about this extension point -->
  </ExtensionPoint>        
</DesktopFormFactor>

并且在FunctionFile中你可以添加一个函数,它可以调用Office.context.ui.openBrowserWindow(url)在excel之外的默认浏览器中启动URL

and in the FunctionFile you could add a function, which can call Office.context.ui.openBrowserWindow(url) to launch the URL in the default browser outside of excel

Office.context.ui.openBrowserWindow("https://github.com");

可以在 此处找到该文档,描述了如何实现manifest中FunctionName定义的函数.

The document can be found at here, which describes how to implement the function defined by FunctionName in the manifest.

这篇关于在 Excel 之外的浏览器中从 Ribbon 中的按钮直接打开网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆