Share via


BuildingBlockGalleryContentControl.BuildingBlockType Property (2007 System)

Gets or sets the type of the building blocks that are displayed in the BuildingBlockGalleryContentControl.

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

Syntax

'Declaration
Public Property BuildingBlockType As WdBuildingBlockTypes
'Usage
Dim instance As BuildingBlockGalleryContentControl 
Dim value As WdBuildingBlockTypes 

value = instance.BuildingBlockType

instance.BuildingBlockType = value
public WdBuildingBlockTypes BuildingBlockType { get; set; }
public:
property WdBuildingBlockTypes BuildingBlockType {
    WdBuildingBlockTypes get ();
    void set (WdBuildingBlockTypes value);
}
public function get BuildingBlockType () : WdBuildingBlockTypes 
public function set BuildingBlockType (value : WdBuildingBlockTypes)

Property Value

Type: WdBuildingBlockTypes
One of the WdBuildingBlockTypes values.

Exceptions

Exception Condition
COMException

The property is set to a WdBuildingBlockTypes value that identifies a category of building blocks that cannot be displayed in a BuildingBlockGalleryContentControl.

Remarks

All building blocks belong to a gallery and a category. Use the BuildingBlockType property to specify which gallery of building blocks to display in the BuildingBlockGalleryContentControl.

A BuildingBlockGalleryContentControl can display only certain galleries of building blocks. The BuildingBlockType property can be set only to the following WdBuildingBlockTypes values:

  • wdTypeAutoText

  • wdTypeCustom1

  • wdTypeCustom2

  • wdTypeCustom3

  • wdTypeCustom4

  • wdTypeCustom5

  • wdTypeCustomAutoText

  • wdTypeCustomEquations

  • wdTypeCustomQuickParts

  • wdTypeCustomTables

  • wdTypeEquations

  • wdTypeQuickParts

  • wdTypeTables

To specify the category of building blocks that are displayed by the BuildingBlockGalleryContentControl, use the BuildingBlockCategory property.

Examples

The following code example adds a new BuildingBlockGalleryContentControl to the beginning of the document. The BuildingBlockGalleryContentControl displays equation building blocks that are provided by Microsoft Office Word. The example sets the BuildingBlockType property to wdTypeEquations.

This version is for a document-level customization. To use this code, paste it into the ThisDocument class in your project, and call the AddBuildingBlockControlAtSelection method from the ThisDocument_Startup method.

Dim buildingBlockGalleryControl1 As Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl

Private Sub AddBuildingBlockGalleryControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    buildingBlockGalleryControl1 = Me.Controls.AddBuildingBlockGalleryContentControl( _
        "buildingBlockGalleryControl1")
    With buildingBlockGalleryControl1
        .PlaceholderText = "Choose an equation"
        .BuildingBlockCategory = "Built-In"
        .BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations
    End With 
End Sub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

private void AddBuildingBlockControlAtSelection()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Select();

    buildingBlockControl1 = this.Controls.AddBuildingBlockGalleryContentControl(
        "buildingBlockControl1");
    buildingBlockControl1.PlaceholderText = "Choose an equation";
    buildingBlockControl1.BuildingBlockCategory = "Built-In";
    buildingBlockControl1.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

This version is for an application-level add-in. To use this code, paste it into the ThisAddIn class in your project, and call the AddBuildingBlockControlAtSelection method from the ThisAddIn_Startup method.

Dim buildingBlockGalleryControl1 As BuildingBlockGalleryContentControl

Private Sub AddBuildingBlockGalleryControlAtSelection()
    If Me.Application.ActiveDocument Is Nothing Then 
        Return 
    End If 

    Dim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
    vstoDoc.Paragraphs(1).Range.InsertParagraphBefore()
    vstoDoc.Paragraphs(1).Range.Select()
    buildingBlockGalleryControl1 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl( _
        "buildingBlockGalleryControl1")
    With buildingBlockGalleryControl1
        .PlaceholderText = "Choose an equation"
        .BuildingBlockCategory = "Built-In"
        .BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations
    End With 
End Sub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

private void AddBuildingBlockControlAtSelection()
{
    if (this.Application.ActiveDocument == null)
        return;

    Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
    vstoDoc.Paragraphs[1].Range.InsertParagraphBefore();
    vstoDoc.Paragraphs[1].Range.Select();

    buildingBlockControl1 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl(
        "buildingBlockControl1");
    buildingBlockControl1.PlaceholderText = "Choose an equation";
    buildingBlockControl1.BuildingBlockCategory = "Built-In";
    buildingBlockControl1.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

.NET Framework Security

See Also

Reference

BuildingBlockGalleryContentControl Class

BuildingBlockGalleryContentControl Members

Microsoft.Office.Tools.Word Namespace

Change History

Date

History

Reason

July 2008

Added a version of the code example for an application-level add-in.

SP1 feature change.