我的单词vsto加载项中有以下ribbon.xml:
- <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>
以及click事件背后的代码:
- 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");
- }