VSTO字激活功能区选项卡 [英] VSTO Word activate ribbon tab
本文介绍了VSTO字激活功能区选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下ribbon.xml我的道VSTO插件:
I have the following ribbon.xml in my word vsto add-in:
<tab id="TabLetters" getVisible="IsLettersTabVisible" label="Letters">
<group id="LettersGroup" label="Letters">
<toggleButton id="NewWithTemplate"
label="New using template Controls"
size="large"
imageMso="FileNew"
onAction="NewTemplated" />
</toggleButton>
</group>
</tab>
和的单击事件下面的代码:
And the following code behind the click event:
public void NewTemplated(Office.IRibbonControl control, bool value)
{
CloseDocument();
var doc = Globals.ThisAddIn.Application.Documents.Add(Template: @"LETTER_V2.dotx", Visible: true);
doc.Activate();
_ribbon.ActivateTab("TabLetters");
}
我本来期望这导致我的功能区选项卡打开新窗口但它只是保持主页选项卡是可见/电流。我如何做到这一点,我的卡是一个是可见的?
I would have expected this to result in a new window with my ribbon tab opened, however it just remains the HOME tab that is visible/current. How do I make it happen that my tab is the one that is visible?
推荐答案
下面是你可以用它来设置两种方式激活的标签:
Here are two ways you can use to set the active tab:
TabLetters.RibbonUI.ActivateTab(TabLetters);
或
Globals.Ribbons.CustomRibbon.Tabs[Your tab id].RibbonUI.ActivateTab("TabLetters");
这篇关于VSTO字激活功能区选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文