BuildingBlockGalleryContentControl.BuildingBlockType (Propiedad)

Obtiene o establece el tipo 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 BuildingBlockType As WdBuildingBlockTypes
WdBuildingBlockTypes BuildingBlockType { get; set; }

Valor de propiedad

Tipo: Microsoft.Office.Interop.Word.WdBuildingBlockTypes
Uno de los valores de Microsoft.Office.Interop.Word.WdBuildingBlockTypes.

Excepciones

Excepción Condición
COMException

La propiedad está establecida en un valor Microsoft.Office.Interop.Word.WdBuildingBlockTypes que identifica una categoría de bloques de creación que no se pueden mostrar en BuildingBlockGalleryContentControl.

Comentarios

Todos los bloques de creación pertenecen a una galería y a una categoría.Utilice la propiedad BuildingBlockType para especificar la galería de bloques de creación que se va a mostrar en el objeto BuildingBlockGalleryContentControl.

Un objeto BuildingBlockGalleryContentControl sólo puede mostrar ciertas galerías de bloques de creación.La propiedad BuildingBlockType sólo se puede establecer en los siguientes valores de Microsoft.Office.Interop.Word.WdBuildingBlockTypes:

  • wdTypeAutoText

  • wdTypeCustom1

  • wdTypeCustom2

  • wdTypeCustom3

  • wdTypeCustom4

  • wdTypeCustom5

  • wdTypeCustomAutoText

  • wdTypeCustomEquations

  • wdTypeCustomQuickParts

  • wdTypeCustomTables

  • wdTypeEquations

  • wdTypeQuickParts

  • wdTypeTables

Para especificar la categoría de bloques de creación que se muestra en el objeto BuildingBlockGalleryContentControl, utilice la propiedad BuildingBlockCategory.

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 BuildingBlockType en wdTypeEquations.

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)