This project has moved. For the latest updates, please go here.

How to populate dynamic RibbonControls at runtime?

Apr 22, 2015 at 9:31 AM
Hi there!

I'd like to migrate an existing VSTO Excel Application Addin to NetOffice.

This Addin uses RibbonControls which are populated with dynamic data at runtime (mostly "dynamicMenu" and some databound "comboBox" controls). For "dynamicMenu" I used to implement a "getContent" callback that instanciates and returns nested RibbonMenu controls.

What is the preferred way to do this with NetOffice (without using "Microsoft.Office.Tools.Ribbon")?
Can "Microsoft.Office.Tools.Ribbon" coexist with NetOffice (without loosing NetOffice's flexibility regarding Office and Visiual Studio versions)?

Thanks for your help and for your amazing project!

Best regards,
Thomas
Coordinator
Apr 22, 2015 at 2:11 PM
hey thomas,

Its a NetOffice Tools Addin or just implement IExtensibility2 ?

I currently work for a visual ribbon designer (as similar as possible to VSTO)
At the moment, to create a ribbon dynamicly at runtime you have to override the GetCustomUI method.
    public override string GetCustomUI(string RibbonID)
    {
        return _myXml;
    }
For more runtime flexibility in dropdown elements you have to set the names of the callback methods("getContent") at hand in the ribbon.xml schema.
(VSTO gives you a nice option to generate an xml schema from the designer. its a good way to start from)

*Sebastian