Share via


ContentControlContentUpdatingEventArgs-Schnittstelle

Stellt Daten für das ContentUpdating-Ereignis eines Inhaltssteuerelements bereit.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

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

Der ContentControlContentUpdatingEventArgs-Typ macht die folgenden Member verfügbar.

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft Content Ruft den Text ab, der in das Inhaltssteuerelement des benutzerdefinierten XML-Abschnitts geschrieben wird, der an das Inhaltssteuerelement gebunden ist.

Zum Seitenanfang

Beispiele

Im folgenden Codebeispiel werden Ereignishandler für das ContentUpdating-Ereignis und das StoreUpdating-Ereignis dargestellt.In diesem Beispiel wird davon ausgegangen, dass das Dokument ein PlainTextContentControl mit dem Namen plainTextContentControl1 enthält, das an ein Element in einem benutzerdefinierten XML-Abschnitt gebunden ist.Ein Codebeispiel, das die Bindung eines Inhaltssteuerelements an ein Element in einem benutzerdefinierten XML-Abschnitt veranschaulicht, finden Sie unter Exemplarische Vorgehensweise: Binden von Inhaltssteuerelementen an benutzerdefinierte XML-Abschnitte.

Wenn Sie diesen Code verwenden möchten, fügen Sie ihn in der ThisDocument-Klasse im Projekt ein.In C# müssen Sie außerdem die Ereignishandler an das ContentUpdating-Ereignis und das StoreUpdating-Ereignis von plainTextContentControl1 anfügen.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

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.");
}

Siehe auch

Referenz

Microsoft.Office.Tools.Word-Namespace

Weitere Ressourcen

Inhaltssteuerelemente

Übersicht über benutzerdefinierte XML-Abschnitte

Exemplarische Vorgehensweise: Binden von Inhaltssteuerelementen an benutzerdefinierte XML-Abschnitte