none
ControlIdType Custom or Office? RRS feed

  • Question

  • Hi Everyone,

    I am working on a Word 2010 Application-level add-in with a ribbon.  When I attempt to debug the ribbon, it loads, but the tab never shows.

     

    When searching for a solution in this forum, I found this discussion: http://social.msdn.microsoft.com/Forums/en/vsto/thread/7eed076c-a43e-48a1-af02-511be97a359b where in McLean suggests setting the ControlIdType to 'Custom.'  

    I have done that and the ribbon now shows, but WHY did that work?  What does the ControlId do and why isn't leaving it set to the default of 'Office' working?

     

    Thanks in advance for any help!

    Tuesday, September 6, 2011 10:22 PM

Answers

  • Hi Susan,

    Thanks for your post.

    Actually, VSTO ribbon designer does make the default of "Office" to work. The reason you haven't see your tab is that you have might  disable the tab in Office UI. Please check this:

    File -> Options -> Customize Ribbon -> In the right category, you will see:

    Please check the Add-Ins item. By default, all the custom ribbon of VSTO appear in this tab, If the Add-Ins tab is disable in this dialog, you will not see it in Office UI

    I hope this solves your problem.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 7, 2011 10:45 AM
    Moderator

All replies

  • Hi,

     

    If you are using Ribbon (Visual Designer) then default ControlIdtype for the ribbon tab is "Office".Optionally you can able to change this to "Custom" also.

    If you are using Ribbon (XML) then we have option insertBeforeMso and insertAfterMso to set the custom tab position.

     

    ControlIdType : http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribboncontrolid.controlidtype(v=vs.90).aspx

    ControlId : http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbontab.controlid(v=VS.90).aspx

    Additional info about Office/Custom controidtype  : 

    http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/44ce99e1-ebb9-4829-bbb2-5217ce209014/

     


    venugopal
    Wednesday, September 7, 2011 3:06 AM
  • Hi Susan,

    Thanks for your post.

    Actually, VSTO ribbon designer does make the default of "Office" to work. The reason you haven't see your tab is that you have might  disable the tab in Office UI. Please check this:

    File -> Options -> Customize Ribbon -> In the right category, you will see:

    Please check the Add-Ins item. By default, all the custom ribbon of VSTO appear in this tab, If the Add-Ins tab is disable in this dialog, you will not see it in Office UI

    I hope this solves your problem.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 7, 2011 10:45 AM
    Moderator
  • Hi Susan

    It would be interesting to know that string value you set for the ControlID. The built-in ("Office") ControlIDs are set string values. If you don't use a known ControlID, then Office can't recognize it and won't show it.

    If you set the type to "Custom", then Office knows it's not supposed to be built-in and can show it.


    Cindy Meister, VSTO/Word MVP
    Wednesday, September 7, 2011 11:18 AM
    Moderator
  • Hi Cindy,

    Calvin hit it on the nose in that I did have the "Add-ins" option in "Customize Ribbon" unchecked.  But I am still struggling to understand what the ControlId and ControlIdType are all about.  This is what I think it is for based on this experience.  Please correct me if I am wrong.  (I am using the Ribbon designer...  I haven't graduated to XML yet : ] )

    Susan's guess:

    If the ControlIdType is set to 'Office', the ribbon will share a ribbon in office that is built-in and is used for 3-rd party ribbons that are NOT designed to hog a ribbon all to themselves.  But if the type is set to 'Custom' you are forcing your ribbon to reserve an entire ribbon to itself.  ???

    Anything you can fix or add to this would be appreciated!

     

    Wednesday, September 7, 2011 3:07 PM
  • Hi Susan

    You're very close, although I might phrase it just a bit differently :-)

    By default, the Ribbon Designer offers you the Add-ins tab. That is a built-in tab. Originally, it was put there to pick up all the old CommandBars customizations (menus, toolbars) from older versions of Office. At some point, the "philosophy" mutated a bit and developers are advised that this is where they should all share Ribbon customizations. This may be fine for small things, but not so good if the functionality you offer is extensive. OTOH, lots of tabs in the Ribbon for one or two controls doesn't make much sense, either. So you do what's good for you.

    As far as the other built-in tabs go, such as Home, Insert, etc. The developer can "share" these, as well, in that Groups can be added to them, and built-in groups can be hidden, if absolutely necessary. So if you have something "small" that has to do with Inserting, or with Page Layout, or whatever, that would be the tab to put it in. In this case, you'd need the ControlId of the Tab (like TabHome, TabAddins). VSTO will take care of making sure things go to the right places. If you want to add things to more than one tab, then you add a Tab to the Ribbon Designer and make the appropriate settings (this is something that's NOT in the documentation!)

    If you want an entire tab to yourself, then you add a tab to the Ribbon. That will, by default, be a "custom" type and you give it your own ControlID name.

    Does this make things any clearer :-)? Or did I just muddy the waters even more (at the end of a loooong day)?


    Cindy Meister, VSTO/Word MVP
    Wednesday, September 7, 2011 4:25 PM
    Moderator
  • Cindy!  This is gold!

    I have spent hours on the web and a small fortune in books, but I haven't been able to find anything that explains this so clearly! 

    Can you recommend any books on VSTO? 

     

    I can't thank you enough for your help!

    Wednesday, September 7, 2011 4:45 PM
  • Hi Susan

    to the best of my knowledge, there are two worth-while books for VSTO. One is aimed at those migrating from VBA and was written for VS 2005 SE (VSTO for Mere Mortals). The other is aimed at "professional developer", was written for version 2008 and the code is C# (Visual Studio Tools for Office 2007).

    The first does discuss the Ribbon Designer in some detail. I'm not sure the second mentions it at all :-)

    Both are good, in their own way; both by people who worked at Microsoft on the VSTO product. I'm not sure which level you're at so can't really make a recommendation for the one or the other.

    There are a couple of other books out there, but some are out-right bad and others barely know what they're talking about (some publisher's "pet authors" who think they can dip in their big toe, then write profoundly about a topic).

    The reason there are so few books is that, basically, VSTO sells worse than books about programming the Word object model.

    FWIW I profited most from the second book, in conjunction with ".NET DEvelopment for Office" by Andrew Whitechapel. I originally come from VBA, so I've had to read, re-read and re-read - and I'm still learning new things. But they contain a wealth of information that's going to be lost as the people who made the transition from COM to .NET slowly leave the scene.


    Cindy Meister, VSTO/Word MVP
    Wednesday, September 7, 2011 4:55 PM
    Moderator