简体   繁体   English

Office 2010的“自定义”选项卡/组中添加包含不需要的命令

[英]Office 2010 Add in custom tab/group contains unwanted commands

I've inherited an Excel 2010 VSTO which has a button under it's own tab to initiate some code (I'm also new to VS and C#). 我继承了Excel 2010 VSTO,它在其自己的选项卡下具有一个按钮以启动一些代码(我也是VS和C#的新手)。

My issue is when I deploy it I'm getting extra commands appearing under 'Menu commands' and a 'Toolbar Commands' groups; 我的问题是,在部署它时,“菜单命令”和“工具栏命令”组下出现了额外的命令; these belong to other apps that have Excel integration but not their own tab/groups. 这些属于具有Excel集成功能的其他应用程序,但不属于自己的标签/组。

I've searched for references to Menu and Toolbar within the solution but can't see them anywhere. 我已经在解决方案中搜索了对菜单和工具栏的引用,但是在任何地方都看不到它们。

My Tab's across the ribbon are; 功能区上的“我的标签”是;

File | 档案| Home | 主页| Insert | 插入| Page Layout | 页面布局 Formulas | 公式| Data | 数据 Review | 评论| View | 查看| Developer | 开发人员 Boyce Tools 2 (my addin) | Boyce Tools 2(我的插件)| Other add in 1 | 其他加1 | Other add in 2 | 其他添加2 | Other add in 3 | 其他添加3 | Other add in 4 | 其他添加4 |

I've specified names for the tab and group 'Boyce Tools 2', so just not sure how these other commands are getting there? 我已经为“ Boyce Tools 2”选项卡和组指定了名称,所以只是不确定这些其他命令是如何到达的? Is it possible other addins are just defaulting to the first tab that isn't an office MS one? 是否有可能其他插件仅默认为不是Office MS的第一个选项卡?

Ribbon.Designer.cs Ribbon.Designer.cs

namespace ReportFramework
{
    partial class Ribbon : Microsoft.Office.Tools.Ribbon.RibbonBase
    {
        /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    public Ribbon()
        : base(Globals.Factory.GetRibbonFactory())
    {
        InitializeComponent();
    }

    /// <summary> 
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Component Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.tabBoyceTools = this.Factory.CreateRibbonTab();
        this.grpBoyceCAL = this.Factory.CreateRibbonGroup();
        this.btnGenerateCAL = this.Factory.CreateRibbonButton();
        this.tabBoyceTools.SuspendLayout();
        this.grpBoyceCAL.SuspendLayout();
        // 
        // tabBoyceTools
        // 
        this.tabBoyceTools.ControlId.ControlIdType = Microsoft.Office.Tools.Ribbon.RibbonControlIdType.Office;
        this.tabBoyceTools.Groups.Add(this.grpBoyceCAL);
        this.tabBoyceTools.Label = "Boyce Tools 2";
        this.tabBoyceTools.Name = "tabBoyceTools";
        // 
        // grpBoyceCAL
        // 
        this.grpBoyceCAL.Items.Add(this.btnGenerateCAL);
        this.grpBoyceCAL.Label = "CAL";
        this.grpBoyceCAL.Name = "grpBoyceCAL";
        // 
        // btnGenerateCAL
        // 
        this.btnGenerateCAL.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
        this.btnGenerateCAL.Label = "Format CAL";
        this.btnGenerateCAL.Name = "btnGenerateCAL";
        this.btnGenerateCAL.OfficeImageId = "MacroPlay";
        this.btnGenerateCAL.ShowImage = true;
        this.btnGenerateCAL.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnGenerateCAL_Click);
        // 
        // Ribbon
        // 
        this.Name = "Ribbon";
        this.RibbonType = "Microsoft.Excel.Workbook";
        this.Tabs.Add(this.tabBoyceTools);
        this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.Ribbon_Load);
        this.tabBoyceTools.ResumeLayout(false);
        this.tabBoyceTools.PerformLayout();
        this.grpBoyceCAL.ResumeLayout(false);
        this.grpBoyceCAL.PerformLayout();

    }

    #endregion

    internal Microsoft.Office.Tools.Ribbon.RibbonTab tabBoyceTools;
    internal Microsoft.Office.Tools.Ribbon.RibbonGroup grpBoyceCAL;
    internal Microsoft.Office.Tools.Ribbon.RibbonButton btnGenerateCAL;
}

partial class ThisRibbonCollection
{
    internal Ribbon Ribbon
    {
        get { return this.GetRibbon<Ribbon>(); }
    }
}

} ' }'

Only an issue on the dev machine when running in Debug mode. 在调试模式下运行时,仅在开发机上存在问题。

In Release mode or in an actual installed version of the VSTO, it's not an issue 在发布模式或VSTO的实际安装版本中,这不是问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM