Free Support Forum - aspose.com

Objects in the merge field values

What kinds of objects could be passed in the object array for merge field values? Is is possible to replace a merge field with the contents of another word document by passing in a word document as an object?

Thanks,

Shyam

If you don’t provide an event handler for the MergeFieldEvent, then objects you pass to the mail merge are converted to strings using their ToString() method.

When you provide an event handler, you got those objects in the event handler and can do whatever you want with them and either just return a string to the mail merge engine as a field value, or use DocumentBuilder to insert complex and formatted content instead of a simple string.

It is not really possible to insert one document into another or insert any fragment from one document into another. This will be supported later when we implement fully functional Range objects like in MS Word Object Model. At the moment it is only possible to move fragments from one document to another in sections, see Sections and Section classes.