两个并排打开的任务窗格 [英] Two open taskpanes side by side

查看:42
本文介绍了两个并排打开的任务窗格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个具有两个功能区按钮的 Office 加载项.每个按钮都链接到不同的 TaskpaneId,然后点击每个按钮打开一个不同的任务窗格:

I am making an Office add-in which has two ribbon buttons. Each button is linked to a different TaskpaneId, and clicking on each button opens a different taskpane:

<bt:Urls>
    <bt:Url id="Contoso.Taskpane1.Url" DefaultValue="https://localhost:3000/addin/page1" />
    <bt:Url id="Contoso.Taskpane2.Url" DefaultValue="https://localhost:3000/addin/page2" />
</bt:Urls>

我似乎看到过一些 Office 加载项,其中两个任务窗格可以同时并排显示(我忘记了具体是哪个加载项).我不时需要这个,有人知道如何实现吗?

It seems that I have seen some Office Add-ins where two task panes can be shown side by side simultaneously (I forgot which exactly the add-ins are). I need this from time to time, does anyone know how to realise this?

推荐答案

Script Lab 就是这样的一个添加-在.您需要做的就是创建两个不同的按钮,这些按钮具有 ShowTaskpane 操作和 不同 ID.

Script Lab is one such add-in. All you need to do is create two different buttons that have a ShowTaskpane action with different IDs.

脚本实验室的产品清单示例:https://github.com/OfficeDev/script-lab/blob/master/manifests/script-lab-prod.xml

Example from Script Lab's prod manifest: https://github.com/OfficeDev/script-lab/blob/master/manifests/script-lab-prod.xml

            <Control xsi:type="Button" id="PG.CodeCommand">
              <Label resid="PG.CodeCommand.Label" />
              <Supertip>
                <Title resid="PG.CodeCommand.TipTitle" />
                <Description resid="PG.CodeSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Code.16" />
                <bt:Image size="32" resid="PG.Icon.Code.32" />
                <bt:Image size="80" resid="PG.Icon.Code.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>  
                        <===== A taskpane ID. This one is a "special" one that allows the taskpane
                               to auto-open if a document is marked as belonging to the add-in.

                <SourceLocation resid="PG.Code.Url" />
                <Title resid="PG.CodeCommand.Title" />
              </Action>
            </Control>
            <Control xsi:type="Button" id="PG.RunCommand">
              <Label resid="PG.RunCommand.Label" />
              <Supertip>
                <Title resid="PG.RunCommand.TipTitle" />
                <Description resid="PG.RunSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Run.16" />
                <bt:Image size="32" resid="PG.Icon.Run.32" />
                <bt:Image size="80" resid="PG.Icon.Run.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                        <===== Whereas this one dosn't specify a taskpane ID,
                               and so it is different by default (but probably
                               should be explicit, come to think of it...)

                <SourceLocation resid="PG.Run.Url" /> 
                <Title resid="PG.RunCommand.Title" />
              </Action>
            </Control>

对于自动打开,请参见 https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document.

For the auto-open in particular, see https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document.

这篇关于两个并排打开的任务窗格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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