Evento Document.MailMergeDataSourceLoad

Viene generato quando l'origine dati viene caricata per una stampa unione.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Sintassi

'Dichiarazione
Event MailMergeDataSourceLoad As EventHandler
event EventHandler MailMergeDataSourceLoad

Esempi

Nell'esempio di codice viene illustrato come visualizzare un messaggio al caricamento dell'origine dati per una stampa unione. Questo esempio è valido per un componente aggiuntivo a livello di applicazione.

Private Sub DocumentMailMergeDataSourceLoad()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeDataSourceLoad, AddressOf ThisDocument_MailMergeDataSourceLoad
End Sub

Private Sub ThisDocument_MailMergeDataSourceLoad(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 loading.")
End Sub
private void DocumentMailMergeDataSourceLoad()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeDataSourceLoad += new EventHandler(ThisDocument_MailMergeDataSourceLoad);
}

void ThisDocument_MailMergeDataSourceLoad(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 loading.");
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Document Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Word