locked
Quick Access toolbar Issue in Ribbon.xml RRS feed

  • Question

  • Hi,

    I have created a custom ribbon for MS Word, which has got some custom ribbon buttons.

    Example - My Ribbon name is 'MyCustomRibbon' and ribbon buttons are 'MyRibbonButton1' and 'MyRibbonButton2'.

    Both of the above buttons has got there own specific functionality. We Enable/Disable/Hide these button based on some subscriptions or entitlements.

    The issue is : We have an option to Customize 'Quick Access toolbar' at the top left of the MS Word window. On click of that option, click on 'More Commands..' and 'Customize Ribbon' option. Using this we will be able to use the functionality of 'MyRibbonButton1' and 'MyRibbonButton2' custom ribbon even if the User has not subscribed to those buttons which is an Issue(Without taking any subscriptions User will be able to make use of the functionality of my custom ribbon buttons).

    I tried the below option as suggested by Deepak in this forum, but i am getting error when i have the highlighted code startFromScratch="true" in my Ribbon.xml.

    <?xml version="1.0" encoding="utf-8" ?>
    <customUI onLoad="RibbonLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="GetImage">
      <commands>
        <command idMso="FileClose" onAction="OnFileClose"/>
        <command idMso="FileSendAsAttachment" onAction="OnFileSendAsAttachment"/>
      </commands>
      <ribbon startFromScratch="true">
          <qat>
             <sharedControls>
                <control id="grpMyRibbonButton1" getVisible="MyRibbonButton1Visible"/>

                 <control id="grpMyRibbonButton2" getVisible="MyRibbonButton2Visible"/>

            </sharedControls>
          </qat>

    <tabs>
          <tab keytip="MCRT" id="MCRibbonTab" getLabel="GetTabItemLabel">
            <group id="grpMyRibbonButton1" image="IconBackgroundSmall">
              <toggleButton id="MyRibbonButton1" keytip="BGRB1" getEnabled="GetEnabled" onAction="OnMyRibbonButton1Click" label="My Ribbon Button1" showImage="true" image="IconBackgroundRB1Large" size="large" getPressed="GetPressed" />
            </group>

    <group id="grpMyRibbonButton2" image="IconBackgroundSmall">
              <toggleButton id="MyRibbonButton2" keytip="BGRB2" getEnabled="GetEnabled" onAction="OnMyRibbonButton2Click" label="My Ribbon Button2" showImage="true" image="IconBackgroundRB2Large" size="large" getPressed="GetPressed" />
              </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    "MS Word stopped working" with the below problem details: Problem signature:
      Problem Event Name:    CLR20r3
      Problem Signature 01:    WINWORD.EXE
      Problem Signature 02:    14.0.7169.5000
      Problem Signature 03:    57177399
      Problem Signature 04:    MyRibbon
      Problem Signature 05:    3.2.25.0
      Problem Signature 06:    57574aa3
      Problem Signature 07:    124
      Problem Signature 08:    22c
      Problem Signature 09:    N3CTRYE2KN3C34SGL4ZQYRBFTE4M13NB
      OS Version:    6.1.7601.2.1.0.256.4
      Locale ID:    1033

    Additional information about the problem:
      LCID:    1033
      skulcid:    1033

    Basically if the user don't have subscription to any of the Ribbon group/Ribbon button i have to disable those buttons in my Custom Ribbon(I am able to achieve this in Custom Ribbon) and also when user try to add Ribbon button/Ribbon group through Customize QAT(here everytime the Ribbon buttons is enabled irrespective of user has subscription or not). Thanks in advance.


    Regards, Chetan.



    Chetan Rajakumar

    Tuesday, June 21, 2016 4:51 AM

Answers

  • Hi Chetan Rajakumar,

    I also get a behavior like you when I run your code.

    all other tabs are not displaying now.

    but use the code below to insert in QAT.

    <?xml version="1.0" encoding="utf-8" ?>
     <customUI onLoad="RibbonLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="GetImage">
    
     <ribbon startFromScratch="true">
        <qat>
          <sharedControls>
            <button idMso="FileSave" visible="true" />
            <button idMso="Cut" visible="true" />
             <button idMso="Copy" visible="true" />
           <button idMso="Paste" visible="true" />
            <button idMso="FileOpen" visible="true" />
          </sharedControls>
        </qat>
      </ribbon>
     </customUI>

    it will give you output like below.

    then use the same logic to hide and visible that you have implement for your buttons in the ribbon.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 22, 2016 4:06 AM

All replies

  • Hi, when i debug the code i was getting the error message - "The calling thread must be STA, because many UI components require this", I was able to resolve this error.

    Now i don't see any error message when Word document is opened, but i am not seeing the expected behavior.

    On opening Word document i see only 2 tabs- 'File' tab and my 'MyCustomRibbon' tab. I don't see any other tabs,  on click of 'Customize QAT' all the options are disabled. This is not my requirement.

    My requirement is :

    Basically if the user don't have subscription to any of the Ribbon group/Ribbon button i have to disable those buttons/groups in my Custom Ribbon(I am able to achieve this in Custom Ribbon) and also when user try to add Ribbon button/Ribbon group through Customize QAT(here every-time the Ribbon buttons is enabled/added irrespective of user has subscription or not). If the user adds the ribbon button that he has not subscribed, still he will be able to use the functionality of that ribbon button through Customize Quick Access Toolbar. Please someone let me know how i can disable the ribbon groups or buttons in Customize Quick Access toolbar if user don't have subscription to those buttons . Thanks in advance.


    Chetan Rajakumar


    Tuesday, June 21, 2016 7:48 PM
  • Hi Chetan Rajakumar,

    I also get a behavior like you when I run your code.

    all other tabs are not displaying now.

    but use the code below to insert in QAT.

    <?xml version="1.0" encoding="utf-8" ?>
     <customUI onLoad="RibbonLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="GetImage">
    
     <ribbon startFromScratch="true">
        <qat>
          <sharedControls>
            <button idMso="FileSave" visible="true" />
            <button idMso="Cut" visible="true" />
             <button idMso="Copy" visible="true" />
           <button idMso="Paste" visible="true" />
            <button idMso="FileOpen" visible="true" />
          </sharedControls>
        </qat>
      </ribbon>
     </customUI>

    it will give you output like below.

    then use the same logic to hide and visible that you have implement for your buttons in the ribbon.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 22, 2016 4:06 AM
  • Hi Chetan Rajakumar,

    to display your ribbon again disable the addin.

    it will show your ribbon again.

    or you can set start from scratch=false

    then also it will show you your ribbon back.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 22, 2016 5:46 AM