none
Visual Studio tools for office -Ribbon Control RRS feed

  • Question

  • Hi,

       i created a ribbon control in office Word using c# as wordAddIn . In ribbon control i am using EditBox . how i can associate keypress event or any other event just like a normal textbox? Editbox has only textchange event.

     

    Thanks,

    Kailash

     

     

    Tuesday, August 16, 2011 8:13 AM

Answers

All replies

  • Hi Kailash

    There is no provision for any "keypress event" in any ribbon control. Possibly, you could do something with the Windows API or perhaps with Ribbon Accessibility (or a combination of the two). For more about the Ribbon Accessibility interface, see

     


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 16, 2011 9:48 AM
    Moderator
  • Hi Cindy

      Thanks for quick reply. Is it possible to handle the ribbon controls like checkbox enable/disbale  based on openDocument and new document event in WordAddIn ? I saw some of the sample but new document event is not working. It would be great if i get some working sample in c# for both OpenDocument and new document.

     

    Thanks in advance.

     

    Kailash 

     

    Tuesday, August 16, 2011 10:07 AM
  • Hi Kailash

    This is VSTO add-in? Using the Ribbon Designer or Ribbon XML?


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 16, 2011 11:08 AM
    Moderator
  • Hi Cindy

    This is "Ribbon Designer".

     

     

    Tuesday, August 16, 2011 11:18 AM
  • You set the control object's Enabled property to True or False, as required.

    From the class the has the events, you can use the Globals keyword to access the Ribbon. For example:

     

    RibbonInDoc r = Globals.Ribbons[1] as RibbonInDoc;
    r.btnTest1.Enabled =
    true;

    Cindy Meister, VSTO/Word MVP
    Tuesday, August 16, 2011 11:37 AM
    Moderator
  • Thanks Cindy for your reply. But i was looking for OpenDocument and NewDocument Event  Office Word AddIn in c#.

     

    Thanks,

    Kailash

    Tuesday, August 16, 2011 11:42 AM
  • In the ThisAdd_Startup just start defining the event by typing

    this

    .Application.DocumentOpen +=

    at this point, you should get Intellisense that lets you press TAB, then TAB again to finish the event and write the code stub.


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 16, 2011 1:28 PM
    Moderator