简体   繁体   中英

Add Excel ribbon controls at runtime (VSTO 2005SE)

Does anyone know how to modify the content of the Excel ribbon at runtime with VSTO 2005SE? Not only update labels or dynamic menus, but also add or remove buttons, tabs, groups, drop downs etc. At runtime means not only at my add-in startup, but also during work with Excel.

Irrespective of VS version, I don't think all that you want is actually possible with the current version of the RibbonX control*. Specifically, there's no functionality for adding and removing. You can control visibility, though, so you can put everything in by default and make it visible or otherwise as needed.

* which was 2007 at time of writing - Excel/Office 2010 may have changed things

I agree with Mike, working with the visibility callback on controls or groups is probably your best bet (that's what we are using).

The entire ribbon layout is loaded from an XML string. I don't know if it is possible to trigger a reload of the XML, which you could then customize to load different XML content.

If you use Visual Studio 2008, you have a great ribbon designer.

Do you want to have methods that is triggered by excel?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM