RibbonFactory.CreateRibbonManager Method
Creates an IRibbonExtensibility object that represents a Ribbon customization.
Assembly: Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)
Parameters
- ribbons
- Type: Microsoft.Office.Tools.Ribbon.IRibbonExtension[]
An array of IRibbonExtension instances.
Return Value
Type: Microsoft.Office.Core.IRibbonExtensibilityAn object that represents a Ribbon customization.
The following example uses a condition to determine which custom Ribbon to display. This example then uses the CreateRibbonManager method to create and then return an IRibbonExtension object that represents the custom Ribbon.
Note
|
|---|
|
The syntax used in this example returns a Ribbon that was created by using the Ribbon (Visual Designer) item. The syntax for returning a Ribbon that is created by using a Ribbon (XML) item is slightly different. For more information about returning a Ribbon (XML) item, see Ribbon XML. |
protected override Microsoft.Office.Core.IRibbonExtensibility
CreateRibbonExtensibilityObject()
{
if (myCondition == true)
{
return Globals.Factory.GetRibbonFactory().CreateRibbonManager(
new Microsoft.Office.Tools.Ribbon.IRibbonExtension[] { new Ribbon1() });
}
else
{
return Globals.Factory.GetRibbonFactory().CreateRibbonManager(
new Microsoft.Office.Tools.Ribbon.IRibbonExtension[] { new Ribbon2() });
}
}
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Note