Microsoft Office VSTO加载项:如何从ThisAddIn类访问功能区xml控件

时间:2020-04-10 22:48:42

标签: c# vsto office-interop office-addins

VS2019的{​​{1}} VSTO project中,我通过使用WORD AddIn在选项卡中创建了按钮,如下所示。并且Ribbon XML自动生成了如下所示的VS2019类。 问题:如何从ThisAddIn.cs类以编程方式访问Ribbon XML的按钮控件btnButton

备注:有些官员,例如this ,展示了如何为ThisAddIn.cs做这件事。但是,我需要为Ribbon Designer做。

Ribbon1.XML

Ribbon XML

ThisAddIn.cs

<ribbon>
    <tabs>
      <tab id="TabID"  label="TEST">
        <group id="MyGroup" label="My Group">
          <button id="btnButton" label="Insert Text" screentip="Test button" onAction="OnTextButton" getEnabled="Get_Enabled" tag="textButtonTag"/>
        </group>
      </tab>
    </tabs>
</ribbon>

0 个答案:

没有答案
相关问题