We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words.Settings.MailMergeCheckErrors.CollectErrors

Hi,


i’m wondering how I can use the mail merge option to list mail merge missing field that are in de doc but not found in the datasource.

i don’t find any clear exemple of that use.

my code look like :

Dim doc As Document = documentTemplate.Clone()

doc.MailMergeSettings.CheckErrors = Aspose.Words.Settings.MailMergeCheckErrors.CollectErrors

Try
doc.MailMerge.Execute(dataSource)
Catch ex As Exception
Dim message As String = String.Format(“Mail merge fail : {0}”, ex)
Throw New MailMergeException(message)
End Try

Dim outStream As MemoryStream = New MemoryStream()

doc.Save(outStream, SaveFormat.Pdf)

Dim data As Byte() = outStream.ToArray()

Return data

Hi Marc,


Thanks for your inquiry. This can be easily achieved by calling MailMerge.GetFieldNames method after MailMerge.Execute(dataSource) method call. In this case, Aspose.Words will first merge fields in document with corresponding fields found in data source and then you can get collection of mail merge field names still available in the document. I hope, this helps.

Best regards,