0

I'm working on a new feature for an existing Excel office add-in. This feature requires a new context menu item, however when I add a new item in manifest, only the first menu item shows.

The documentation says you can add "other controls, as needed" - however this is does not work for me.

Code sample below:

 <ExtensionPoint xsi:type="ContextMenu">
  <OfficeMenu id="ContextMenuCell">
    <Control xsi:type="Button" id="Menu1">
      <Label resid="Menu1.Label"/>
      <Supertip>
        <Title resid="Menu1.Label"/>
        <Description resid="Menu1.Tooltip"/>
      </Supertip>
      <Icon>
        <bt:Image size="16" resid="Icon.16x16"/>
        <bt:Image size="32" resid="Icon.32x32"/>
        <bt:Image size="80" resid="Icon.80x80"/>
      </Icon>
      <Action xsi:type="ExecuteFunction">
        <FunctionName>action2</FunctionName>
      </Action>
    </Control>
    <Control xsi:type="Button" id="Menu2">
      <Label resid="Menu2.Label"/>
      <Supertip>
        <Title resid="Menu2.Label"/>
        <Description resid="Menu2.Tooltip"/>
      </Supertip>
      <Icon>
        <bt:Image size="16" resid="Icon.16x16"/>
        <bt:Image size="32" resid="Icon.32x32"/>
        <bt:Image size="80" resid="Icon.80x80"/>
      </Icon>
      <Action xsi:type="ExecuteFunction">
        <FunctionName>action4</FunctionName>
      </Action>
    </Control>
  </OfficeMenu>
</ExtensionPoint>

I have tried this with xsi:type="Menu" and xsi:type="Button" - in both examples the bottom menu item is not shown.

Is this a bug or am I missing something? Thanks.

1
  • Can you add a screenshot of what you are seeing? Commented May 24, 2022 at 19:35

1 Answer 1

2

Hi the ContextMenuCell or ContextMenuText will only allow each add-in to add either a button control or a menu control. You can only add 1 top level menu/button to the Office ContextMenu. At the time it was designed this way so that the Office context menu doesn't get flooded with 3rd party controls. Within your menu, you can only have buttons at the moment.

Sign up to request clarification or add additional context in comments.

9 Comments

Oh no really? So i am unable to add 2 buttons to the context menu? I will have to add a xsi:Menu and group the 2 buttons inside that? Thats going to be a pain for productivity. Do you know if there are there any plans of enabling multiple context menu items for single add-in?
Yes, so to be able to add multiple controls, you first need to add one sub-menu to the Context Menu, then add additional buttons inside the menu. I will take note of this pain point for you so it can be added to our backlog. All backlogged items are reviewed and evaluated against other requests. In your situation, I would start with what I suggested first.
You can also try to add key tip to your context menu buttons to help speed up a keyboard user if they press the context menu button their keyboard. I believe in the xml manifest, in the label of your control, you can put an ampersand (&amp;) in front of a letter to get the underline to appear under it you want it to have a key tip. (Note it's been years since I've tried the key tip).
Good suggestion RE key tip. Will have a play with that. Thanks for the advice.
@WorksOnMyLocal Unfortunately I was unable to find a work around. However, I haven't looked at this since the question was asked, so perhaps Angela-MSFT can give us an update if this is possible now.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.