Let the button open a new window
Asked Answered
K

1

0

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?

Korten answered 29/7, 2017 at 11:34 Comment(1)
you can google it using the words "action button to open url in dialog ms office add-in"Unwind
U
0

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-Add-in-Dialog-API-Simple-Example

Unwind answered 1/8, 2017 at 3:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.