Mail Merge with Client-side word document

Is there sample code or can someone outline the general steps I should take to accomplish the following:
1. Display a datagrid of contact information with checkboxes; allow the user to check all or any
2. Allow the user to prepare a client side word document (mail merge capable form letter)
3. Merge the checked datagrid information into the form letter
4. Print from browser

Also, is there a users guide, vb code samples in addition to what is found in the download of the evaluation copy?

Thank you in advance for your help.

Hi,

1. For examples how to use a datagrid please look elsewhere, there are good articles on MSDN and other general development websites such as www.codeproject.com.

2. User needs to insert mail merge fields into the document using Insert/Field command in MS Word, just make sure they type proper field names.

3. There should be enough vb code examples in the API documentation and in the demo project included with the product installer (the installer is the same for release and evaluation version).

In general, you need to open a document and then call Document.MailMerge.Execute passing some data source into it which could be a DataTable or DataView for example. If your data grid is loaded from a DataTable, I believe you should be able to create a DataView that reflects rows filtered by the user, but please, see MSDN documentation and articles how best to do it.

4. You can send the document to the client browser to open in MS Word on the client machine, but you cannot remotely instruct it to print automatically because that would be a security issue on the client computer. We don’t have a good solution for this right now and I don’t think anybody has.

In the future, we plan to make Aspose.Word being able to render pages and print documents by itself.

Thank you for your quick response. If you could clarify a couple of things I would appreciate it.


1. I'm ok with the datagrid select.

2. I'm trying to do a web application where the user can edit a form letter and then do a mail merge. Is my best course of action to have a user open a word document that is already setup with the merge fields (and residing on the server) using document.open and then use document builder to allow user edits? Assuming this is right, after the edits are done does the user need to save prior to executing the mail merge?

Thank you again!

You don’t need to save the document after modifying it with DocumentBuilder, you can use it for mail merge straight away.