Propriedade BuildingBlockGalleryContentControl.BuildingBlockCategory

Obtém ou define a categoria dos blocos de construção que são exibidos na BuildingBlockGalleryContentControl.

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

Sintaxe

'Declaração
Property BuildingBlockCategory As String
    Get
    Set
string BuildingBlockCategory { get; set; }

Valor de propriedade

Tipo: System.String
A categoria dos blocos de construção que são exibidos na BuildingBlockGalleryContentControl.

Comentários

Todos os blocos de construção pertencer a uma categoria e uma galeria. Use o BuildingBlockCategory propriedade para especificar a categoria dos blocos de construção que são exibidos pela BuildingBlockGalleryContentControl. Você pode definir o valor dessa propriedade para o interno ou Geral categorias definidas pelo Word de Microsoft Office, ou você pode especificar uma categoria personalizada.

Para especificar qual galeria dos blocos de construção para exibir o BuildingBlockGalleryContentControl, use o BuildingBlockType propriedade.

Exemplos

O exemplo de código a seguir adiciona um novo BuildingBlockGalleryContentControl para o início do documento. O BuildingBlockGalleryContentControl exibe os blocos de construção equação fornecidos pelo Word de Microsoft Office. O exemplo define o BuildingBlockCategory propriedade para o interno categoria.

Esta versão é para uma personalização em nível de documento. Para usar esse código, colá-lo na ThisDocument classe em seu projeto e a chamada a AddBuildingBlockControlAtSelection método a partir do ThisDocument_Startup método.

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

Esta versão é um suplemento em nível de aplicativo. Para usar esse código, colá-lo na ThisAddIn classe em seu projeto e a chamada a AddBuildingBlockControlAtSelection método a partir do ThisAddIn_Startup método.

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

Segurança do .NET Framework

Consulte também

Referência

BuildingBlockGalleryContentControl Interface

Namespace Microsoft.Office.Tools.Word