I would like to know if it is possible to customize the rubbon of word 2007 not at the application level but at the document level.
I mean the customizations should appear only for a specific word document.
Thanks,
mathmax
Hello mathmax,
The short answer is Yes! The "Custom Ribbon UI" column of the "Comparison of UI features" table on http://msdn2.microsoft.com/en-us/library/bf08984t(VS.90).aspx does show that the Ribbon can be used for both document-level customizations and application-level addins.
m.
Hi mathmax,
We have changed the API responsible for accessing Ribbon instances between Beta 2 and RTM.
In Beta 2 you could access ribbons using RibbonManager class:
Ribbon1 ribbon1 = RibbonManager.GetRibbon<Ribbon1>();
foreach (OfficeRibbon ribbon in RibbonManager.Ribbons)
{ /* iterate through all ribbon instances */ }
In RTM we have changed it to use Globals class:
Ribbon1 ribbon1 = Globals.Ribbons.Ribbon1;
foreach (OfficeRibbon ribbon in Globals.Ribbons)
{ /* iterate through all ribbon instances */ }
Thank you,
Vlad
I glad that you found a good solution. This scenario will be not changed in the RTM version.
You are right the RibbonManager API only returns ribbon instances used by the application and it will return not null only when Ribbon is already shown to the user.
Globals.Ribbons.Ribbon1 will return not null because it returns a ribbon "prototype", a single instance created per Ribbon. I.e. internally it will be very similar to your code.
BTW, RibbonManager may accept a variable list of ribbons and you can simply write
return new Microsoft.Office.Tools.Ribbon.RibbonManager(CustomRibbon);
RTM is the final version of the Visual Studio 2008. Please watch for official announcements about its release date.
I cannot answer your question if it will be free to download - please see official information about VS 2008 pricing.
Thank you,
Vlad