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