Partager via


BuildingBlockGalleryContentControl.PlaceholderText, propriété

Obtient ou définit le texte affiché dans le BuildingBlockGalleryContentControl jusqu'à ce que le texte soit modifié par une action utilisateur ou une autre opération.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word (dans Microsoft.Office.Tools.Word.dll)

Syntaxe

'Déclaration
Property PlaceholderText As String
string PlaceholderText { get; set; }

Valeur de propriété

Type : System.String
Texte affiché dans le contrôle jusqu'à ce qu'il soit modifié par une action utilisateur ou une autre opération.

Notes

Le texte de l'espace réservé est affiché jusqu'à ce qu'un utilisateur sélectionne un bloc de construction ou que le contrôle soit rempli avec les données d'une source de données.

Pour affecter à l'espace réservé le texte qui se trouve dans un BuildingBlock ou un Range, utilisez la méthode SetPlaceholderText.

Exemples

L'exemple de code suivant ajoute un nouveau BuildingBlockGalleryContentControl au début du document. BuildingBlockGalleryContentControl affiche des blocs de construction d'équation fournis par Microsoft Office Word. L'exemple affecte à la propriété PlaceholderText une chaîne qui invite l'utilisateur à choisir une équation.

Cette version est destinée à une personnalisation au niveau du document. Pour utiliser ce code, collez-le dans la classe ThisDocument de votre projet, puis appelez la méthode AddBuildingBlockControlAtSelection à partir de la méthode 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;
}

Cette version est destinée à un complément d'application. Pour utiliser ce code, collez-le dans la classe ThisAddIn de votre projet, puis appelez la méthode AddBuildingBlockControlAtSelection à partir de la méthode 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;
}

Sécurité .NET Framework

Voir aussi

Référence

BuildingBlockGalleryContentControl Interface

Microsoft.Office.Tools.Word, espace de noms