Share via


ContentControlContentUpdatingEventArgs, interface

Fournit les données de l'événement ContentUpdating d'un contrôle de contenu.

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

Syntaxe

'Déclaration
<GuidAttribute("a2f71dcd-984c-4fed-8395-1ca5588190d6")> _
Public Interface ContentControlContentUpdatingEventArgs
[GuidAttribute("a2f71dcd-984c-4fed-8395-1ca5588190d6")]
public interface ContentControlContentUpdatingEventArgs

Le type ContentControlContentUpdatingEventArgs expose les membres suivants.

Propriétés

  Nom Description
Propriété publique Content Obtient ou définit le texte à écrire dans le contrôle de contenu de la partie XML personnalisée liée au contrôle.

Début

Exemples

L'exemple de code suivant illustre les gestionnaires des événements ContentUpdating et StoreUpdating. Cet exemple suppose que le document en cours contient un PlainTextContentControl nommé plainTextContentControl1 qui est lié à un élément dans une partie XML personnalisée. Pour obtenir un exemple de code qui montre comment lier un contrôle de contenu à un élément d'une partie XML personnalisée, consultez Procédure pas à pas : liaison de contrôles de contenu à des parties XML personnalisées.

Pour utiliser ce code, collez-le dans la classe ThisDocument de votre projet. En C#, vous devez également attacher les gestionnaires d'événements aux événements ContentUpdating et StoreUpdating de plainTextContentControl1.

Cet exemple illustre une personnalisation au niveau du document.

Private Sub plainTextContentControl1_StoreUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs) _
    Handles PlainTextContentControl1.StoreUpdating

    MessageBox.Show("The control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to the node that is bound to this control.")
End Sub

Private Sub plainTextContentControl1_ContentUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs) _
    Handles PlainTextContentControl1.ContentUpdating

    MessageBox.Show("The node that is bound to this control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to this control.")
End Sub
void plainTextContentControl1_StoreUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs e)
{
    MessageBox.Show("The control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to the node that is bound to this control.");
}

void plainTextContentControl1_ContentUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs e)
{
    MessageBox.Show("The node that is bound to this control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to this control.");
}

Voir aussi

Référence

Microsoft.Office.Tools.Word, espace de noms

Autres ressources

Contrôles de contenu

Vue d'ensemble des parties XML personnalisées

Procédure pas à pas : liaison de contrôles de contenu à des parties XML personnalisées