Custom image for group in custom ribbon xml

2022-07-07T10:06:44.507+00:00

Hello,

base on [MS-CUSTOMUI]: group (Group) | Microsoft Learn group component has attribute - image.

But when I using this attribute the icon/image of group doesn't change it and doesn't call LoadImage function from ribbon. (Other elements like - button, dropdowns etc. use custom icons)

Linked document show example for image attribute but used component is button not group.

And I'm wondering what I need to change in xml or the image attribute is doesn't supported for new version of office? I mean Microsoft 365.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,720 questions
{count} votes

2 answers

Sort by: Most helpful
  1. 2022-08-02T13:07:40.747+00:00

    To provide some more details.
    Small part of ribbon:
    <customUI http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:im="iManage.WordVstoAddIn.15" xmlns:xxxxx="xxxxxxxx" xmlns="http://schemas.microsoft.com/office/2009/07/customui" loadImage="LoadImage" onLoad="RibbonLoad">

    <commands>
    <command idMso="FileNewDefault" onAction="FileNewOverride" />
    <command idMso="PrintPreviewAndPrint" onAction="FilePrintOverride" />
    </commands>
    <ribbon startFromScratch="false">
    <tabs>
    <tab idQ="xxxxxxx" insertAfterMso="TabHome" label="RibbonForCustomVsto" keytip="X">
    <group idQ="xxxxxxx" insertBeforeQ="xxxxxxxxx" label="Defaults" image="Icon_32_OtherTemplates">
    <button id="XrefPanel" label="XRef" size="large" onAction="ShowXrefPanel" />
    <box id="box0001" boxStyle="vertical">
    <labelControl id="lbl001" label=" " />
    <labelControl id="lbl002" label=" " />
    <button id="btnRefreshAll" imageMso="RefreshAll" screentip="Refresh Document fields" getEnabled="ShowWizardGetEnabled" size="normal" onAction="UpdateDocumentCoiOnAction" />
    </box>
    <dialogBoxLauncher>
    <button id="EditAuthors2" keytip="U" screentip="Edit your author list" onAction="EditAuthorsOnAction" />
    </dialogBoxLauncher>
    </group>
    <group idQ="xxxxxxxxx" insertBeforeQ="xxxxxxxx" label="DMS" image="Icon_32_OtherTemplates">
    <box id="boxDMSOpts1" boxStyle="vertical">
    <control idMso="FileOpen" size="normal" />
    <control idMso="FileClose" size="normal" />
    <control idMso="FileSave" size="normal" />
    </box>
    <box id="boxDMSOpts12" boxStyle="vertical">
    <editBox id="QuickOpen" tag="openDmsDocument" keytip="OO" screentip="xxxxx" getEnabled="RunCommandEnabled" onChange="RunCommandActionOnChange" />
    <button id="EditProfile" tag="editDmsProfile" label="Edit Profile" keytip="OP" imageMso="FileProperties" screentip="Edit the document's DMS profile" getEnabled="RunCommandEnabled" size="normal" onAction="RunCommandAction" />
    </box>
    <splitButton id="BtnDocIdOptions" getVisible="InsertDocIdVisible" getEnabled="InsertDocIdEnabled" size="large">
    <button id="BtnInsertDocId" label="Doc ID Options" image="Icon_64_AddDocRef" onAction="BtnInsertDocIdAction" />
    <menu id="MnuInsertDocId">
    <button id="BtnInsertDocId2" label="Doc ID Options" image="Icon_64_AddDocRef" onAction="BtnInsertDocIdAction" />
    <button id="BtnRemoveDocId" label="Remove Doc ID" image="Icon_64_ReferenceRemoval" onAction="BtnRemoveDocIdAction" />
    </menu>
    </splitButton>
    <control idMso="FileSaveAs" size="normal" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>

    LoadImage method:
    public IPictureDisp LoadImage(string imageName)

    I notice that - the LoadImage is not fired to load image for group, but if I set imageMso - is okey.

    But I don't see any particular reason why event is not fired for custom icon.

    0 comments No comments

  2. Oskar Shon 866 Reputation points MVP
    2022-11-11T13:12:04.14+00:00

    I notice that - the LoadImage is not fired to load image for group, but if I set imageMso - is okey.

    But I don't see any particular reason why event is not fired for custom icon.

    Yes, buttons can have image or imageMso but group too.
    As you see in first case you can have no imaga on group, but in 2nd case you have it

    259583-image.png

    That's like that it is in full view:

    259500-image.png

    and code as you try it:

    <group id="Licencja" getLabel="GetLabel" autoScale="true" imageMso="AppointmentColorDialog">  
    

    Anyway I use older shema for XML
    xmlns="http://schemas.microsoft.com/office/2009/07/customui"

    aa and one more thing.
    Image for group works when you have couple buttons, not single and that do not works in context I suppose.

    Regards

    0 comments No comments