Compartilhar via


BuildingBlockGalleryContentControl.BuildingBlockType A propriedade (sistema de 2007)

Obtém ou define o tipo dos blocos de construção exibidos no BuildingBlockGalleryContentControl.

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

Sintaxe

Public Property BuildingBlockType As WdBuildingBlockTypes

Dim instance As BuildingBlockGalleryContentControl
Dim value As WdBuildingBlockTypes

value = instance.BuildingBlockType

instance.BuildingBlockType = value
public WdBuildingBlockTypes BuildingBlockType { get; set; }

Valor de propriedade

Tipo: Microsoft.Office.Interop.Word.WdBuildingBlockTypes
Um do Microsoft.Office.Interop.Word.WdBuildingBlockTypes valores.

Exceções

Exceção Condição
COMException

A propriedade é conjunto para um Microsoft.Office.Interop.Word.WdBuildingBlockTypes valor que identifica uma categoria de blocos de construção que não podem ser exibidos em um BuildingBlockGalleryContentControl.

Comentários

Todos os blocos de construção pertencer a uma galeria e uma categoria.Use o BuildingBlockType propriedade para especificar qual galeria dos blocos de construção para exibir o BuildingBlockGalleryContentControl.

A BuildingBlockGalleryContentControl pode exibir somente determinadas galerias de blocos de construção. The BuildingBlockType propriedade pode ser definida apenas para os seguintes Microsoft.Office.Interop.Word.WdBuildingBlockTypes valores:

  • wdTypeAutoText

  • wdTypeCustom1

  • wdTypeCustom2

  • wdTypeCustom3

  • wdTypeCustom4

  • wdTypeCustom5

  • wdTypeCustomAutoText

  • wdTypeCustomEquations

  • wdTypeCustomQuickParts

  • wdTypeCustomTables

  • wdTypeEquations

  • wdTypeQuickParts

  • wdTypeTables

Para especificar a categoria de blocos estruturais que são exibidas, a BuildingBlockGalleryContentControl, use o BuildingBlockCategory propriedade.

Exemplos

O exemplo de código a seguir adiciona um novo BuildingBlockGalleryContentControl para o início do documento. The BuildingBlockGalleryContentControl Exibe os blocos de construção equação que são fornecidos pelo Microsoft Office palavra. O exemplo define o BuildingBlockType propriedade para wdTypeEquations.

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

Dim buildingBlockGalleryControl1 As Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl

PrivateSub 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
    EndWithEndSub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

privatevoid 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 é para um suplemento no nível de aplicativo.Para usar esse código, cole-o no ThisAddIn classe em seu projeto e a telefonar a AddBuildingBlockControlAtSelection método a partir do ThisAddIn_Startup método.

Dim buildingBlockGalleryControl1 As BuildingBlockGalleryContentControl

PrivateSub AddBuildingBlockGalleryControlAtSelection()
    IfMe.Application.ActiveDocument IsNothingThenReturnEndIfDim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
    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
    EndWithEndSub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

privatevoid AddBuildingBlockControlAtSelection()
{
    if (this.Application.ActiveDocument == null)
        return;

    Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
    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;
}

Permissões

Consulte também

Referência

BuildingBlockGalleryContentControl Classe

Membros BuildingBlockGalleryContentControl

Namespace Microsoft.Office.Tools.Word