Share via


BuildingBlockGalleryContentControl.PlaceholderText (Propiedad)

Obtiene o establece el texto que se muestra en BuildingBlockGalleryContentControl hasta que este texto se modifica mediante una acción del usuario o alguna otra operación.

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

Sintaxis

'Declaración
Property PlaceholderText As String
    Get
    Set
string PlaceholderText { get; set; }

Valor de propiedad

Tipo: System.String
El texto que se muestra en el control hasta que se modifica por una acción del usuario o cualquier otra operación.

Comentarios

El texto del marcador de posición se muestra hasta que un usuario selecciona un bloque de creación o el control se rellena con datos de un origen de datos.

Para establecer el texto del marcador de posición en el texto que está en BuildingBlock o Range, utilice el método SetPlaceholderText.

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 PlaceholderText en una cadena que pide al usuario que elija una ecuación.

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)