Dynamic Mailmerge instead of Template


#1

I am new to the ASPOSE product line so you'll have to forgive my ignorance. What I want to do is retrieve data in dataset and use the columns as the merge fields. The columns selected in the data can change each time so I don't want to have to create a template before hand. Is this possible? Any samples of this would be great.

Thanks.

Smile [:)]


#2

MailMerge currently supports DataTable, DataView, DataRow and IDataReader as a valid data source for MailMerge.Execute. See Executing Mail Merge article in Aspose.Word documentation or online on

http://www.aspose.com/Wiki/default.aspx/Aspose.Word/ExecutingMailMerge.html


#3

Thanks, here is what I am doing.

1.Get my dataset

Dim doc As Document = New Document("E:\lsac\ACES2\DEV\WWWROOT\ACES2\Reports\WordReports\MyDocument.doc")

doc.MailMerge.Execute(oDS.Tables(0))

'Save the document

doc.Save("E:\lsac\ACES2\DEV\WWWROOT\ACES2\Reports\WordReports\PersonalizedLetter.doc")

I then want to be able to go to PersonalizedLetter.doc in word and place the merge fields in the mailmerge toolbar on the document. Is that possible? The mail merge toolbar is disabled.

Thanks.


#4

After you execute MailMerge on a document and save it all mergefields for which there was data in the datasource are substituted with actual data. So ideally there’s no mergefields left in the document after that. So please explain, why do you want to use mailmerge toolbar after the document is already merged with data?