Share via


DocumentBase.CreateRibbonObjects Method

Returns an array of OfficeRibbon objects to the CreateRibbonExtensibilityObject method.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Protected Overridable Function CreateRibbonObjects As IRibbonExtension()
protected virtual IRibbonExtension[] CreateRibbonObjects()

Return Value

Type: array<Microsoft.Office.Tools.Ribbon.IRibbonExtension[]
An array of OfficeRibbon objects.

Remarks

This method is called by the default implementation of the CreateRibbonExtensibilityObject method when the project contains Ribbon (Visual Designer) items.

You can also override the CreateRibbonExtensibilityObject method to specify which Ribbons to display at run time. For more information, see Ribbon Overview.

Examples

The following code example overrides the CreateRibbonObjects method in the ThisDocument class and returns an array of two OfficeRibbon objects. The example requires that you add two Ribbons to your project called Ribbon1 and Ribbon2 by using the Ribbon (Visual Designer) item. To use this example, run it from the ThisDocument class in a document-level project.

Protected Overrides Function CreateRibbonObjects() As  _
Microsoft.Office.Tools.Ribbon.IRibbonExtension()
    Dim allRibbons(1) As Microsoft.Office.Tools.Ribbon.IRibbonExtension
    allRibbons(0) = New Ribbon1
    allRibbons(1) = New Ribbon2
    Return allRibbons
End Function
protected override Microsoft.Office.Tools.Ribbon.IRibbonExtension[] CreateRibbonObjects()
{
    Microsoft.Office.Tools.Ribbon.IRibbonExtension[] allRibbons =
        new Microsoft.Office.Tools.Ribbon.IRibbonExtension[2];
    allRibbons[0] = new Ribbon1();
    allRibbons[1] = new Ribbon2();
    return allRibbons;
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace