2017-04-04 67 views
0

我跟隨此MSDN Tutorial創建一個WORD 2010VSTO AddIn Tab。我正在使用VS2015 Community Edition。當我在Visual Studio中運行應用程序時,它會打開Word文檔,但Tab不會顯示在WORD中(正如測試步驟所聲稱的那樣)。所以,我無法測試AddIn。定製功能區XML選項卡不顯示在WORD VSTO加載項

但是,我可以在WORD的COM加載項窗口中看到上面的AddIn啓用 - 如下圖所示。另外,當我在下面的過程中放置​​斷點時,我可以看到這個過程被成功調用。 注意:我通過複製/粘貼代碼,項目名稱等逐字跟隨教程。所以,我沒有改變教程。

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() 
{ 
    return new MyRibbon(); 
} 

enter image description here

UPDATE:本MyRibbon.xml如下所示。

<?xml version="1.0" encoding="UTF-8"?> 
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> 
    <ribbon> 
    <tabs> 
     <tab idMso="TabAddIns"> 
     <group id="ContentGroup" label="Content"> 
      <button id="textButton" label="Insert Text" 
       screentip="Text" onAction="OnTextButton" 
       supertip="Inserts text at the cursor location."/> 
      <button id="tableButton" label="Insert Table" 
       screentip="Table" onAction="OnTableButton" 
       supertip="Inserts a table at the cursor location."/> 
     </group> 
     </tab> 
    </tabs> 
    </ribbon> 
</customUI> 

更新2:由以下@dotNET閱讀評論之後,我覺得這個問題似乎是我的Word文檔丟失內置ADD-INS。我如何顯示ADD-INS選項卡?從WORD中的自定義選項卡選項中,我看不到如下圖所示的選項卡。我應該在哪裏看?

enter image description here

+0

ü可以分享您的絲帶XML? – dotNET

+0

@dotNET當然,我只是在** UPDATE **部分添加了功能區XML文件內容。 – nam

回答

1

你的按鈕將被添加到使用您所提供的代碼內置ADD-INS標籤。如果您想要自己的自定義選項卡,請勿使用idMso。相反定義<tab>節點是這樣的:

<tab id="tabMyVeryOwnCustomTab" label="TRUMPED"> 
    <group id="ContentGroup" label="Content"> 
     <button id="textButton" label="Insert Text" 
      screentip="Text" onAction="OnTextButton" 
      supertip="Inserts text at the cursor location."/> 
     <button id="tableButton" label="Insert Table" 
      screentip="Table" onAction="OnTableButton" 
      supertip="Inserts a table at the cursor location."/> 
    </group> 
</tab> 
+0

謝謝你試圖幫助。我如何找到'ADD-INS'選項卡。我在'WORD 2010'中看不到它? – nam

+0

應該在那裏默認。您可以使用「選項」對話框中的「自定義功能區」選項卡來始終顯 – dotNET

+0

我已經添加了**更新2 **。我沒有在功能區選項卡選項對話框中看到'ADD-INS'選項卡,如上圖2所示。 – nam

相關問題