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 事件的事件處理常式。 這個範例假設文件中包含名為 plainTextContentControl1 且繫結至自訂 XML 組件中之項目的 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 命名空間