Udostępnij za pośrednictwem


Właściwość BuildingBlockGalleryContentControl.BuildingBlockType —

Pobiera lub ustawia typ bloków konstrukcyjnych, które są wyświetlane w BuildingBlockGalleryContentControl.

Przestrzeń nazw:  Microsoft.Office.Tools.Word
Zestaw:  Microsoft.Office.Tools.Word (w Microsoft.Office.Tools.Word.dll)

Składnia

'Deklaracja
Property BuildingBlockType As WdBuildingBlockTypes
WdBuildingBlockTypes BuildingBlockType { get; set; }

Wartość właściwości

Typ: Microsoft.Office.Interop.Word.WdBuildingBlockTypes
Jednym z Microsoft.Office.Interop.Word.WdBuildingBlockTypes wartości.

Wyjątki

Wyjątek Warunek
COMException

Właociwooć jest ustawiona na Microsoft.Office.Interop.Word.WdBuildingBlockTypes wartość, która określa kategorię bloki konstrukcyjne, które nie mogą być wyświetlane w BuildingBlockGalleryContentControl.

Uwagi

Wszystkie bloki konstrukcyjne należą do galerię i kategorię.Użycie BuildingBlockType właściwość, aby określić które galerii bloków konstrukcyjnych do wyświetlenia w BuildingBlockGalleryContentControl.

A BuildingBlockGalleryContentControl można wyświetlić tylko niektóre galerii bloków konstrukcyjnych.BuildingBlockType Właściwość można ustawić tylko dla następujących Microsoft.Office.Interop.Word.WdBuildingBlockTypes wartości:

  • wdTypeAutoText

  • wdTypeCustom1

  • wdTypeCustom2

  • wdTypeCustom3

  • wdTypeCustom4

  • wdTypeCustom5

  • wdTypeCustomAutoText

  • wdTypeCustomEquations

  • wdTypeCustomQuickParts

  • wdTypeCustomTables

  • wdTypeEquations

  • wdTypeQuickParts

  • wdTypeTables

Określenie kategorii bloków konstrukcyjnych, które są wyświetlane przez BuildingBlockGalleryContentControl, użyj BuildingBlockCategory właściwość.

Przykłady

Poniższy kod dodaje nowy BuildingBlockGalleryContentControl do początku dokumentu.BuildingBlockGalleryContentControl Wyświetla równanie bloków konstrukcyjnych, które są dostarczane przez program Microsoft Office Word.W przykładzie ustawiana BuildingBlockType właściwość, aby wdTypeEquations.

Ta wersja jest dla dostosowania poziomu dokumentu.Aby użyć tego kodu, wklej go do ThisDocument klasy w projekcie i wywołanie AddBuildingBlockControlAtSelection metodę z ThisDocument_Startup metody.

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

Ta wersja jest na poziomie aplikacji dodatek.Aby użyć tego kodu, wklej go do ThisAddIn klasy w projekcie i wywołanie AddBuildingBlockControlAtSelection metodę z ThisAddIn_Startup metody.

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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

BuildingBlockGalleryContentControl Interfejs

Przestrzeń nazw Microsoft.Office.Tools.Word