让按钮打开一个新窗口 [英] Let the button open a new window
本文介绍了让按钮打开一个新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在外接程序的选项卡下添加一个按钮,单击该按钮应在新窗口或对话框中打开URL.我尝试了以下方法:
I want to add a button under the tab of my add-in, and clicking on the button should open a URL in a new window or Dialog box. I tried the follows:
<Group id="Contoso.Tab1.Group2">
<Label resid="Contoso.Tab1.GroupLabel" />
<Icon>
<bt:Image size="16" resid="Contoso.TaskpaneButton3.Icon" />
<bt:Image size="32" resid="Contoso.TaskpaneButton3.Icon" />
<bt:Image size="80" resid="Contoso.TaskpaneButton3.Icon" />
</Icon>
<Control xsi:type="Button" id="Contoso.TaskpaneButton3">
<Label resid="Contoso.TaskpaneButton3.Label" />
<Supertip>
<Title resid="Contoso.TaskpaneButton3.Label" />
<Description resid="Contoso.TaskpaneButton3.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Contoso.TaskpaneButton3.Icon" />
<bt:Image size="32" resid="Contoso.TaskpaneButton3.Icon" />
<bt:Image size="80" resid="Contoso.TaskpaneButton3.Icon" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>Button3</TaskpaneId>
<SourceLocation resid="Contoso.Taskpane3.Url" />
</Action>
</Control>
</Group>
... ...
<bt:Url id="Contoso.Taskpane3.Url" DefaultValue="https://www.stackoverflow.com/" />
问题在于它仍然尝试在任务窗格中而不是在新窗口或对话框中打开该链接.有人知道如何修改清单以实现这一目标吗?
The problem is that it still tries to open that link in a task pane, rather than a new window or Dialog box. Does anyone know how to amend the manifest to achieve this?
推荐答案
在搜索了Office dev之后,我发现您可以将action标签更改为
after googling about office dev , I found that you can change the action tag to something like
<!-- This is what happens when the command is triggered (E.g. click on the Button). Supported actions are ExecuteFunction or ShowTaskpane. -->
<Action xsi:type="ExecuteFunction">
<FunctionName>doSomethingAndShowDialog</FunctionName>
</Action>
检查以下链接可能会有所帮助
check the following link it might be helpful
https://github.com/OfficeDev/Office -在对话框中添加API-简单示例
这篇关于让按钮打开一个新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文