Word Context Menu

Add-in Express™ Support Service
That's what is more important than anything else

Word Context Menu
 
Maurice Schoenmakers




Posts: 17
Joined: 2010-03-21
Hi guys,

I have a question concerning the ADX content menu in Word 2007.
I wish to display an additional context menu item whenever a user right clicks somewhere in a Word document, wether it's just text, a header or a table (or whatever).

I currently have an ADXContextMenu with property CommandBar set to "Text", but this only shows within plain text. As soon as I right click within a table or on a header, the context menu item is not there.

Any idea on how to resolve this?

Thanks in advance.

Best regards,
Maurice Schoenmakers
Posted 03 Feb, 2011 04:23:20 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Maurice,

It looks like this is a bug. I have filed it in our bug-tracking system under #2511.

Thank you for pointing this to me.
.NET, Extended MAPI, Windows Phone & RT
Posted 03 Feb, 2011 07:36:35 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Maurice,

You can use a separate component for each command bar in Word. Moreover, we have investigated the cause of the issue. This is not a bug. You just need to delete the normal.dot template to remove old entries of the context menu items. The documentation states:

Note that main and context menus are command bars. That is, in Word add-ins, custom controls added to these components must have Temporary = False, too. If you set Temporary = True for such controls (say, by accident), they will not be removed when you uninstall your add-in. That happens because Word has another peculiarity: it saves temporary controls when they are added to a built-in command bar. And all context menus are built-in command bars. To remove such controls, you will have to write some code or use a simple way: set Temporary to false for all controls, register the add-in on the affected PC, run Word. At this moment, the add-in finds this control and traces it from this moment on. Accordingly, when you unregister the add-in, the control is removed in a standard way.

Please try to unregister your add-in and then delete the normal.dot template. Does it help?
.NET, Extended MAPI, Windows Phone & RT
Posted 03 Feb, 2011 10:06:13 Top
Maurice Schoenmakers




Posts: 17
Joined: 2010-03-21
Hi Eugene,

Thanks for your reply.

Do I understand correctly that I will have to make like 5 or 10 (or however many) context menu's (=Commandbars) to have the context menu working on different kinds of text (like plain, headers, tables etc)?

As from a maintainability point of view that seem like the most elegant way of solving this; would there be any other way to accomplish this kind of functionality without having to repeat myself?


As for the normal.dot, I indeed noticed this behaviour by setting Temporary to true or false, though I'm not sure what's the relation between this and my actual problem :)

Best regards,
Maurice
Posted 08 Feb, 2011 14:22:27 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Maurice,

1. Yes, you are on the right avenue. You need to use a separate instance of the ADXContextMenu component for each Word (context menu) command bar.

2. No, you don't have any other way. It is by design :-)

3. For more information on this please take a look at the Word add-ins, command bars, and normal.dot section in the online documentation.
.NET, Extended MAPI, Windows Phone & RT
Posted 09 Feb, 2011 11:46:25 Top