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 事件的事件处理程序。此示例假定文档中包含一个名为 plainTextContentControl1 的 PlainTextContentControl,且该控件绑定到某个自定义 XML 部件中的元素。有关演示如何将内容控件绑定到自定义 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 命名空间