次の方法で共有


ContentControlStoreUpdatingEventArgs インターフェイス

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

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

構文

'宣言
<GuidAttribute("5d9c73b6-b14d-43a0-99eb-6ea91fbd8456")> _
Public Interface ContentControlStoreUpdatingEventArgs
[GuidAttribute("5d9c73b6-b14d-43a0-99eb-6ea91fbd8456")]
public interface ContentControlStoreUpdatingEventArgs

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

プロパティ

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

このページのトップへ

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

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

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

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 部分へのコンテンツ コントロールのバインド