让按钮打开一个新的window
Let the button open a new window
我想在我的加载项选项卡下添加一个按钮,单击该按钮应该会在新的 window 或对话框中打开一个 URL。我尝试了以下方法:
<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.whosebug.com/" />
问题是它仍然试图在任务窗格中打开 link,而不是新的 window 或对话框。有谁知道如何修改清单来实现这个?
在谷歌搜索 office dev 后,我发现您可以将操作标签更改为类似
<!-- 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>
检查以下内容link可能会有帮助
https://github.com/OfficeDev/Office-Add-in-Dialog-API-Simple-Example
我想在我的加载项选项卡下添加一个按钮,单击该按钮应该会在新的 window 或对话框中打开一个 URL。我尝试了以下方法:
<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.whosebug.com/" />
问题是它仍然试图在任务窗格中打开 link,而不是新的 window 或对话框。有谁知道如何修改清单来实现这个?
在谷歌搜索 office dev 后,我发现您可以将操作标签更改为类似
<!-- 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>
检查以下内容link可能会有帮助
https://github.com/OfficeDev/Office-Add-in-Dialog-API-Simple-Example