Document.MailMergeAfterRecordMerge 事件
在数据源中的每个记录成功合并到一个邮件合并中之后发生。
命名空间: Microsoft.Office.Tools.Word
程序集: Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)
语法
声明
Event MailMergeAfterRecordMerge As EventHandler
event EventHandler MailMergeAfterRecordMerge
示例
下面的代码示例在引发 MailMergeAfterRecordMerge 事件时显示一条消息。 此示例针对的是应用程序级外接程序。
Private Sub DocumentMailMergeAfterRecordMerge()
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
AddHandler vstoDoc.MailMergeAfterRecordMerge, AddressOf ThisDocument_MailMergeAfterRecordMerge
End Sub
Private Sub ThisDocument_MailMergeAfterRecordMerge(ByVal sender As Object, ByVal e As EventArgs)
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
Dim index As Object = 1
System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.Item(index).Value & _
" is finished merging.")
End Sub
private void DocumentMailMergeAfterRecordMerge()
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.MailMergeAfterRecordMerge += new EventHandler(ThisDocument_MailMergeAfterRecordMerge);
}
void ThisDocument_MailMergeAfterRecordMerge(object sender, EventArgs e)
{
object index = 1;
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.get_Item(ref index).Value
+ " is finished merging.");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。