2017-07-04 92 views
1

我製作了一個Office插件,其中有兩個功能區按鈕。每個按鈕鏈接到不同的TaskpaneId,並點擊每個按鈕打開一個不同的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插件,其中兩個任務窗格可以同時側(我一起展示忘記了哪個加載項是)。我不時需要這個,有沒有人知道如何實現這一點?

回答

0

Script Lab就是這樣一個加載項。您只需創建兩個不同的按鈕,其中ShowTaskpane動作與不同的ID。從腳本實驗室的督促清單

例子: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

+0

對不起邁克爾,它在Excel Online中工作嗎?我不能在Excel Online中並排放置兩個腳本實驗室的任務欄... – SoftTimur

+0

您不能將它們並排放置,但您會看到它們是垂直選項卡。所以你實際上可以打開兩個,只是一次只能看到一個。如果你想要更多的UI靈活性,我建議你在https://officespdev.uservoice.com/上提出問題 –

相關問題