BuildingBlockGalleryContentControl.BuildingBlockCategory (Propiedad)

Obtiene o establece la categoría de los bloques de creación que se muestran en BuildingBlockGalleryContentControl.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word (en Microsoft.Office.Tools.Word.dll)

Sintaxis

'Declaración
Property BuildingBlockCategory As String
string BuildingBlockCategory { get; set; }

Valor de propiedad

Tipo: System.String
La categoría de los bloques de creación que se muestran en BuildingBlockGalleryContentControl.

Comentarios

Todos los bloques de creación pertenecen a una categoría y a una galería.Utilice la propiedad BuildingBlockCategory para especificar la categoría de los bloques de creación que se muestran en BuildingBlockGalleryContentControl.Puede establecer el valor de esta propiedad en las categorías Integrado o General definidas en Microsoft Office Word o puede especificar una categoría personalizada.

Para especificar la galería de bloques de creación que se va a mostrar en BuildingBlockGalleryContentControl, utilice la propiedad BuildingBlockType.

Ejemplos

En el ejemplo de código siguiente se agrega un nuevo BuildingBlockGalleryContentControl al principio del documento.BuildingBlockGalleryContentControl muestra los bloques de creación de ecuación proporcionados por Microsoft Office Word.En el ejemplo se establece la propiedad BuildingBlockCategory en la categoría Built-In.

Se trata de una versión para una personalización en el nivel del documento.Para usar este código, péguelo en la clase ThisDocument del proyecto y llame al método AddBuildingBlockControlAtSelection desde el método ThisDocument_Startup.

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

Se trata de una versión para un complemento en el nivel de la aplicación.Para usar este código, péguelo en la clase ThisAddIn del proyecto y llame al método AddBuildingBlockControlAtSelection desde el método ThisAddIn_Startup.

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

Seguridad de .NET Framework

Vea también

Referencia

BuildingBlockGalleryContentControl Interfaz

Microsoft.Office.Tools.Word (Espacio de nombres)