locked
Possible to Hide Built-in Ribbon Elements? RRS feed

  • Question

  • By using the following markup in my ribbon.xml file, I am attempting to hide the 'Info' and 'Share' tabs in Word 2010:

    <

     

    backstage>
      <
    tab idMso="TabInfo" getVisible="isNotLLSession" />
      <
    tab idMso="TabShare" getVisible="isNotLLSession" />
    </
    backstage>

     However when I load my application I get the following error:

    "RibbonUI callback functions cannot be specified on built-in controls".

    There was no problem doing this to Office Button elements in Word 2007. I haven't seen any references to a change like this....Is the error message for real, and there is NO way to hide or disable built-in elements in 2010? I sure hope not -- that would be the end of the product I am developing which, for legal reasons, needs to keep strict control over saving/exporting options.

    Note that it IS possible to hide built-in elements completely, using

     <backstage>
      <
    tab idMso="TabInfo" visible="false" />
      <
    tab idMso="TabShare" visible="false" />
    </
    backstage>

    But that is not practical as these elements would then be hidden for ALL documents, not just for my application.

    Thanks in advance for any help you can give.

    Saturday, July 3, 2010 10:58 PM

Answers

  • Hi ckapilla

    I quote from the article Introduction to the Office 2010 Backstage View for Developers, by Frank Rice. This is in the FAQ, to a question whether built-in command buttons, fast command buttons or tabs can be repurposed: "It is not possible to override these commands from the custom UI XML markup or by using the object model... A better solution would be to consider hiding the built-in UI and rebuilding it fully with custom commands."

    IOW, you'd hid the built-in tabs and create your own, incorporating the built-in groups and controls, as required. These can be displayed/hidden dynamically.

    An alternate approach would be to have TWO add-ins: one the "controller", the other the one you already have. The "controller" would take care of loading/unloading the add-in with the functionality, as required.

    Another possibility would be to use VSTO or regular Word templates/documents to provide the Ribbon UI, making it document/template-specific. 


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by ckapilla Tuesday, July 6, 2010 5:08 AM
    Sunday, July 4, 2010 9:45 AM

All replies

  • Hi ckapilla

    I quote from the article Introduction to the Office 2010 Backstage View for Developers, by Frank Rice. This is in the FAQ, to a question whether built-in command buttons, fast command buttons or tabs can be repurposed: "It is not possible to override these commands from the custom UI XML markup or by using the object model... A better solution would be to consider hiding the built-in UI and rebuilding it fully with custom commands."

    IOW, you'd hid the built-in tabs and create your own, incorporating the built-in groups and controls, as required. These can be displayed/hidden dynamically.

    An alternate approach would be to have TWO add-ins: one the "controller", the other the one you already have. The "controller" would take care of loading/unloading the add-in with the functionality, as required.

    Another possibility would be to use VSTO or regular Word templates/documents to provide the Ribbon UI, making it document/template-specific. 


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by ckapilla Tuesday, July 6, 2010 5:08 AM
    Sunday, July 4, 2010 9:45 AM
  • Thanks Cindy -- I will pick 'Door #2' !

    When you say "TWO add-ins" do you mean two fully complete COM add-ins, or is it possible within a single COM add-in to have more than one ribbon and switch between them dynamically -- I'm hoping you mean the latter.

    Tuesday, July 6, 2010 5:15 AM
  • Hi ckapilla

    No, I mean the former: two completely separate add-ins. Here are a couple of discussions (some a bit convoluted) where this is a topic, and some suggestions are made.

    Please note that these links are in the VSTO forum, and any restrictions about how they can be loaded (or not) refer to the VSTO add-ins, as opposed to "Shared COM Add-ins". The reasons for the retrictions with a VSTO add-in is the VSTO tool used to manage VSTO add-ins. If your add-in bases directly on IDT2Extensibility, you won't have these restrictions

    http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/7c371bb8-15b5-45b1-a4ea-50c17ea85ed5

    http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f0b004e0-b2d0-4910-8947-5429536a9a21

    It is not possible to switch between Ribbons dynamically within a single Add-in. The Ribbon is loaded when the Add-in is loaded. You can definie more than one Ribbon for an add-in, and load the one required, but once it's loaded, that's the Ribbon you have to work with.


    Cindy Meister, VSTO/Word MVP
    Tuesday, July 6, 2010 8:00 AM
  • Thanks again Cindy, I will read up on what those links have to say and take it from there.

    I'm glad to hear there are some advantages to having stuck with plain ol' IDT2Extensibility.

    Wednesday, July 7, 2010 5:11 AM
  • returning to our story...

    So now I have two add-ins, the first, 'manager' has  LoadBehavior of 'Startup' and its only RibbonUI change is a button to launch the second AddIn.

    The second, 'managed' Add-in has a LoadBehavior of 'OnDemand', and will have the full RibbonUI enhancements.

    The still missing piece for me that I haven't been able to locate is how to actually launch the second Add-in when a button on the first 'manager' add-in is clicked. I'm sure it's simple, but I would very much appreciate an example line of code.

    Friday, July 9, 2010 3:53 AM
  • Hi ckapilla

    Mmm, I'd have thought one of the messages in the links I gave you would have had that...

    wordApp.ComAddins.Item(index).Connect = True

    From the object model Help: "The Connect property returns True if the add-in is active; it returns False if the add-in is inactive. An active add-in is registered and connected; an inactive add-in is registered but not currently connected."


    Cindy Meister, VSTO/Word MVP
    Friday, July 9, 2010 10:12 AM
  • thanks -- this was mentioned in the links, but as you said, that content was convoluted and mostly not relevant to what I am doing (not VSTO). I have known about Connect for a long time, but since I always used Startup I never got the point of it until now.

     

    Chris

    Friday, July 9, 2010 7:58 PM