如何将不同的丝带组合在一起?

时间:2014-11-13 07:39:09

标签: add-in ribbon

我有不同的Excel加载项(* .xlam),它们都具有相同的“标签ID”和相同的标签。但是,当我将它们加载到同一个Excel文件时,每个“加载项”都会创建一个具有相同名称的单独功能区。有没有办法在单独加载时将它们分组到同一个功能区下?

功能区的两个XML代码如下:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
    <tabs>
        <tab id="CompanyFunctions" label="Company Functions ">
    <group id="GrpLogOn" label="Int_Functions"> 
        <button id="CalculateX" label=" Calculate X" imageMso="TableDrawTable" onAction="startCalculateX " size="large" />
    </group>
        </tab>
    </tabs>
</ribbon>

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
    <tabs>
        <tab id="CompanyFunctions" label="Company Functions ">
    <group id="GrpLogOn" label="Int_Functions"> 
        <button id="CalculateY" label=" Calculate Y" imageMso="TableDrawTable" onAction="startCalculateY " size="large" />
    </group>
        </tab>
    </tabs>
</ribbon>

1 个答案:

答案 0 :(得分:2)

您应该使用idQ而不是Id来让它们共享相同的标签/组:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
    xmlns:myaddins="myuniquekey">
<ribbon>
    <tabs>
        <tab idQ="myaddins:CompanyFunctions" label="Company Functions ">
    <group idQ="myaddins:GrpLogOn" label="Int_Functions"> 
        <button id="CalculateX" label=" Calculate X" imageMso="TableDrawTable" onAction="startCalculateX " size="large" />
    </group>
        </tab>
    </tabs>
</ribbon>

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
     xmlns:myaddins="myuniquekey">
<ribbon>
    <tabs>
        <tab idQ="myaddins:CompanyFunctions" label="Company Functions ">
    <group idQ="myaddins:GrpLogOn" label="Int_Functions"> 
        <button id="CalculateY" label=" Calculate Y" imageMso="TableDrawTable" onAction="startCalculateY " size="large" />
    </group>
        </tab>
    </tabs>
</ribbon>