ExecuteWithRegions evaluating version


#1

I’m evaluating the aspose word tool and I am trying to do a mail merge with several datafields. My goals is to create one word document which contains sereral letters generated by the same template but with other values. All the merged documents should be stored in the same file.

This is my code:

Private Sub MailMergeAspose()

Dim doc As Document
doc = New Document(Server.MapPath("/WebApplication2/testfiles/template.doc"))

Dim dataTable As New DataTable
dataTable.TableName = “Testdata"
dataTable.Columns.Add(“Voorletters”)
dataTable.Columns.Add(“VolledigeAchternaam”)
dataTable.Columns.Add(“Voorletters_p”)
dataTable.Columns.Add(“VolledigeAchternaam_p”)
dataTable.Rows.Add(New Object() {“J.”, “Geurjens”, “I.”, “Verhoeven”})
dataTable.Rows.Add(New Object() {“T.”, “Roosen”, “B.”, “LieAtsoen”})
dataTable.Rows.Add(New Object() {“E.”, “Jacobs”, “M.”, “Millenaar”})
dataTable.Rows.Add(New Object() {“R.”, “Knoppers”, “G.”, “Kempkens”})

doc.MailMerge.ExecuteWithRegions(dataTable)
doc.Save(Server.MapPath(”/WebApplication2/testfiles/brief.doc"))

End Sub

Unfortunately this does not work… The garbage in the generated document is the only adjustment that has been made.

Is It possible to use this feature in evaluation mode? If so what am I doing wrong.

Best regards,

Perry


#2

Hi Perry,

Thank you for evaluating Aspose.Word.

You are right, mail merge with regions is the best choice in this case and your code looks correct. Also, functionality of evaluation version of Aspose.Word is totally equivalent to that of commercial version except the evaluation watermark that is injected on the document open/save. Please attach your document template, probably it is formed improperly.


#3

When I preform a normal execute it works the way it should be…


#4

Have you marked the merge region properly as described here? Please however attach your template to let us take a look.