Пример #1
0
        private void AddMenu()
        {
            // Define the existing Menu Bar
            Office.CommandBar menuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar;

            // Add the top level new Menu
            StaticHelper.LogMessage(MessageType.Info, "Adding Controlled Vocab menu");
            Office.CommandBarPopup newMenuBar = (Office.CommandBarPopup)menuBar.Controls.Add(Office.MsoControlType.msoControlPopup, Type.Missing, Type.Missing, Type.Missing, true);
            newMenuBar.Caption = "Controlled Vocab";

            // get the buttons
            StaticHelper.LogMessage(MessageType.Info, "Getting buttons");
            menu[] buttons = StaticHelper.GetControlledVocabularyMenus();

            // build the buttons
            StaticHelper.LogMessage(MessageType.Info, "Building menu");
            this.BuildMenu(newMenuBar, buttons);

            StaticHelper.LogMessage(MessageType.Info, "Making menu visible");
            newMenuBar.Visible = true;
        }