次の方法で共有


ContentControlContentUpdatingEventArgs インターフェイス

コンテンツ コントロールの ContentUpdating イベントにデータを提供します。

名前空間:  Microsoft.Office.Tools.Word
アセンブリ:  Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll 内)

構文

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

ContentControlContentUpdatingEventArgs 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Content コントロールにバインドされているカスタム XML 部分からコンテンツに書き込まれるテキストを取得または設定します。

このページのトップへ

ContentUpdating イベントおよび StoreUpdating イベント用のイベント ハンドラーのコード例を次に示します。 この例では、文書に、カスタム XML 部分の要素にバインドされる plainTextContentControl1 という名前の PlainTextContentControl が含まれていることを前提としています。 カスタム XML 部分の要素にコンテンツ コントロールをバインドする方法を説明するコード例については、「チュートリアル : カスタム XML 部分へのコンテンツ コントロールのバインド」を参照してください。

このコードを使用するには、プロジェクトの ThisDocument クラスにコードを貼り付けます。 C# では、さらにイベント ハンドラーを plainTextContentControl1 の ContentUpdating イベントおよび StoreUpdating イベントに結び付ける必要があります。

この例は、ドキュメント レベルのカスタマイズ用に作成されています。

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

参照

参照

Microsoft.Office.Tools.Word 名前空間

その他の技術情報

コンテンツ コントロール

カスタム XML 部分の概要

チュートリアル : カスタム XML 部分へのコンテンツ コントロールのバインド