Sdílet prostřednictvím


BuildingBlockGalleryContentControl.BuildingBlockCategory – vlastnost

Získá nebo nastaví kategorie stavební bloky, které jsou zobrazeny v BuildingBlockGalleryContentControl.

Obor názvů:  Microsoft.Office.Tools.Word
Sestavení:  Microsoft.Office.Tools.Word (v Microsoft.Office.Tools.Word.dll)

Syntaxe

'Deklarace
Property BuildingBlockCategory As String
string BuildingBlockCategory { get; set; }

Hodnota vlastnosti

Typ: System.String
Kategorie stavební bloky, které jsou zobrazeny v BuildingBlockGalleryContentControl.

Poznámky

Všechny stavební prvky patří do kategorie a Galerie.Použití BuildingBlockCategory vlastnost k určení kategorie stavební bloky, které jsou zobrazeny BuildingBlockGalleryContentControl.Můžete nastavit hodnotu této vlastnosti vestavěné nebo Obecné kategorie jsou definovány aplikací Microsoft Office Word nebo můžete zadat vlastní kategorii.

Chcete-li určit, které galerie stavebních bloků v BuildingBlockGalleryContentControl, použít BuildingBlockType vlastnost.

Příklady

Následující příklad kódu přidá nový BuildingBlockGalleryContentControl na začátku dokumentu.BuildingBlockGalleryContentControl Zobrazí rovnice stavební bloky, které jsou k dispozici v aplikaci Microsoft Office Word.V příkladu je nastavena BuildingBlockCategory vlastnost vestavěné kategorie.

Tato verze je pro vlastní úpravy úrovni dokumentu.Tento kód použít, vložte jej do ThisDocument třídy v projektu a volání AddBuildingBlockControlAtSelection metoda 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;
}

Tato verze je aplikace úroveň doplněk.Tento kód použít, vložte jej do ThisAddIn třídy v projektu a volání AddBuildingBlockControlAtSelection metoda 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;
}

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

BuildingBlockGalleryContentControl Rozhraní

Microsoft.Office.Tools.Word – obor názvů