none
VSTO Ribbon Commands section + Load Behavior 9 problem RRS feed

  • Question

  • I am working on Adin for Microsoft Word.

    I have defined command subscribing to copy, cut and paste commands in my ribbon.xml. In
    load Behavior 3 everything works as expected.

    Now I want to run my Adin in Load Behavior 9 mode to improve start up time of Word, but regular copy, cut and paste actions in Word will not work until my Adin will be initialized through the first ribbon button click or I remove commands section from ribbon.xml.

    Tuesday, January 13, 2015 7:03 PM

All replies

  • Could you please be more specific? What custom UI markup do you have in the ribbon xml file?
    Tuesday, January 13, 2015 7:07 PM
  • <customUI onLoad="RibbonLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="GetImage">
      <commands>
        <command idMso="Paste" onAction="handlePaste" getEnabled="GetEnabledCmd"/>
        <command idMso="Copy" onAction="handleCopy" getEnabled="GetEnabledCmd"/>
        <command idMso="Cut" onAction="handleCut" getEnabled="GetEnabledCmd"/>
      </commands>
    ...

    Tuesday, January 13, 2015 7:13 PM
  • Hi assa1,

    The issue could be reproduced on a test machine but on another has different issue.

    Since the issue is complex,  I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Regards & Fei


    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.

    Friday, January 16, 2015 6:58 AM
    Moderator
  • Hi,

    I went through the problem explained here. Could you share what you have for onAction and getEnabled for these command repurposes.

    I would also like to know which version of Word you have issue with.


    Sangeeth,MSFT

    Thursday, January 22, 2015 1:12 AM
  • Example of handlePaste (handleCopy and handleCut have simmilar code):

            public void handlePaste(Office.IRibbonControl ctrl, ref bool cancel)
            {
                cancel = false;
                try
                {
                    if (ctrl == null || ctrl.Context == null) { return; }
                    MessageBox.Show("Paste Command");
                }
                catch (System.Exception ex)
                {
                    AddInTrace.WriteException(ex);
                    return;
                }
            }

    Note: I have removed all business related code.

    Example of GetEnabled

            public bool GetEnabled(Office.IRibbonControl ctrl)
            {
                try
                {
                    if (!(ctrl != null && ctrl.Context != null))
                        return false;
                    return true;
                }
                catch (System.Exception ex)
                {
                    AddInTrace.WriteException(ex);
                    return false;
                }
            }

    I see this issue in Word 2010 and Word 2013.

    It makes no difference if I do not specify getEnabled="GetEnabledCmd" in Ribbon.xml.

    Thank you,

    Alex

    Thursday, January 22, 2015 4:38 PM
  • Hi,

    The following blog may be helpful here:

    http://blogs.msdn.com/b/vsto/archive/2010/01/07/vsto-performance-delay-loading-and-you.aspx

    If you still face the issues , Because of its complexity your question falls into the paid support category which requires a more in-depth level of support.  If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone


    Sangeeth,MSFT

    Wednesday, February 4, 2015 11:57 PM