using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using Word = Microsoft.Office.Interop.Word; using Office = Microsoft.Office.Core; using Microsoft.Office.Tools.Word; using Microsoft.Office.Core; using System.Windows.Forms; using Microsoft.Office.Tools; using Microsoft.Office.Tools.Ribbon; namespace HTEXLabel { public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { KnowledgeUserControl knowledgeUserControl = new KnowledgeUserControl(); Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane = this.CustomTaskPanes.Add(knowledgeUserControl, "My Custom Task Pane"); // 可选:设置自定义功能面板的属性 myCustomTaskPane.Visible = true; } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { } protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() { //return Globals.Factory.GetRibbonFactory().CreateRibbonManager(new Microsoft.Office.Tools.Ribbon.IRibbonExtension[] { }); return new LableRibbon(); } #region VSTO 生成的代码 /// /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } }