//添加单独的菜单项 public void AddMenu(Microsoft.Office.Core.CommandBarPopup popuBar) { Microsoft.Office.Core.CommandBar menuBar = null; menuBar = this.OWordApplic.CommandBars["Menu Bar"]; popuBar = (Microsoft.Office.Core.CommandBarPopup) this.OWordApplic.CommandBars.FindControl(Microsoft.Office.Core.MsoControlType.msoControlPopup, missing, popuBar.Tag, true); if (popuBar == null) { popuBar = (Microsoft.Office.Core.CommandBarPopup)menuBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlPopup, missing, missing, missing, missing); } }
//添加单独工具栏 public void AddToolItem(string strBarName, string strBtnName) { Microsoft.Office.Core.CommandBar toolBar = null; toolBar = (Microsoft.Office.Core.CommandBar) this.OWordApplic.CommandBars.FindControl(Microsoft.Office.Core.MsoControlType.msoControlButton, missing, strBarName, true); if (toolBar == null) { toolBar = (Microsoft.Office.Core.CommandBar) this.OWordApplic.CommandBars.Add( Microsoft.Office.Core.MsoControlType.msoControlButton, missing, missing, missing); toolBar.Name = strBtnName; toolBar.Visible = true; } }
private void Application_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Selection Selection) { if (contextButton == null) { contextButton = (Office.CommandBarButton)CommandBar.Controls. Add(Office.MsoControlType.msoControlButton, missing, missing, missing, missing); contextButton.accName = "SowSelectedItem"; } contextButton.DescriptionText = "Show Selected item"; contextButton.Caption = contextButton.DescriptionText; contextButton.Tag = "ShowSelectedItem"; contextButton.FaceId = 4000; contextButton.OnAction = "OutlookIntegration.ThisAddIn.ContextMenuItemClicked"; contextButton.Click += ContextMenuItemClicked; }
void _OutlookApplication_ShortcutContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Microsoft.Office.Interop.Outlook.OutlookBarShortcut Shortcut) { DisplayInWatchWindow(ShortcutContextMenuDisplay++, System.Reflection.MethodInfo.GetCurrentMethod().Name); }
void _OutlookApplication_AttachmentContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Microsoft.Office.Interop.Outlook.AttachmentSelection Attachments) { DisplayInWatchWindow(AttachmentContextMenuDisplay++, System.Reflection.MethodInfo.GetCurrentMethod().Name); }
void _OutlookApplication_FolderContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Microsoft.Office.Interop.Outlook.MAPIFolder Folder) { DisplayInWatchWindow(FolderContextMenuDisplay++, System.Reflection.MethodInfo.GetCurrentMethod().Name); }