Share via


BuildingBlockGalleryContentControl.BuildingBlockType-Eigenschaft

Ruft den Typ der Bausteine ab, die im BuildingBlockGalleryContentControl angezeigt werden, oder legt den Typ fest.

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

Syntax

'Declaration
Property BuildingBlockType As WdBuildingBlockTypes
    Get
    Set
WdBuildingBlockTypes BuildingBlockType { get; set; }

Eigenschaftswert

Typ: Microsoft.Office.Interop.Word.WdBuildingBlockTypes
Einer der Microsoft.Office.Interop.Word.WdBuildingBlockTypes-Werte.

Ausnahmen

Ausnahme Bedingung
COMException

Die Eigenschaft wird auf einen Microsoft.Office.Interop.Word.WdBuildingBlockTypes-Wert festgelegt, der eine Kategorie von Bausteinen identifiziert, die nicht in einem BuildingBlockGalleryContentControl angezeigt werden kann.

Hinweise

Alle Bausteine gehören zu einem Katalog und einer Kategorie. Verwenden Sie die BuildingBlockType-Eigenschaft, um anzugeben, welcher Bausteinkatalog im BuildingBlockGalleryContentControl angezeigt werden soll.

Ein BuildingBlockGalleryContentControl kann nur bestimmte Kataloge von Bausteinen anzeigen. Die BuildingBlockType-Eigenschaft kann auf folgende Microsoft.Office.Interop.Word.WdBuildingBlockTypes-Werte festgelegt werden:

  • wdTypeAutoText

  • wdTypeCustom1

  • wdTypeCustom2

  • wdTypeCustom3

  • wdTypeCustom4

  • wdTypeCustom5

  • wdTypeCustomAutoText

  • wdTypeCustomEquations

  • wdTypeCustomQuickParts

  • wdTypeCustomTables

  • wdTypeEquations

  • wdTypeQuickParts

  • wdTypeTables

Um die Kategorie der Bausteine anzugeben, die vom BuildingBlockGalleryContentControl angezeigt werden, verwenden Sie die BuildingBlockCategory-Eigenschaft.

Beispiele

Im folgenden Codebeispiel wird am Anfang des Dokuments ein neues BuildingBlockGalleryContentControl hinzugefügt. Das BuildingBlockGalleryContentControl zeigt Formelbausteine an, die von Microsoft Office Word bereitgestellt werden. Im Beispiel wird die BuildingBlockType-Eigenschaft auf wdTypeEquations festgelegt.

Diese Version bezieht sich auf eine Anpassung auf Dokumentebene. Zum Verwenden dieses Codes fügen Sie ihn in der ThisDocument-Klasse im Projekt ein, und rufen Sie in der ThisDocument_Startup-Methode die AddBuildingBlockControlAtSelection-Methode auf.

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;
}

Diese Version bezieht sich auf ein Add-In auf Anwendungsebene. Zum Verwenden dieses Codes fügen Sie ihn in der ThisAddIn-Klasse im Projekt ein, und rufen Sie in der ThisAddIn_Startup-Methode die AddBuildingBlockControlAtSelection-Methode auf.

Dim buildingBlockGalleryControl1 As BuildingBlockGalleryContentControl

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

    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    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 = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    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-Sicherheit

Siehe auch

Referenz

BuildingBlockGalleryContentControl Schnittstelle

Microsoft.Office.Tools.Word-Namespace