Mail merge with RTF formatted variable

I’m attempting to perform a mail merge using the Java version of Aspose.Words where the variables file is in RTF format and the template file is in DOT format (examples are attached).


Could you please provide some assistance.


Hi Paul,

Thanks for your inquiry. It seems that you want to replace mail merge field with RTF document. If this is the case, we suggest you following solution.

1) Please implement IFieldMergingCallback interface and in IFieldMergingCallback.FieldMerging method move the cursor to the mail merge field using DocumentBuilder.moveToMergeField method.
2) After moving the cursor to the mail merge field, insert the RTF document using DocumentBuilder.InsertDocument method.

Hope this helps you. If you still face problem, please share some more detail about your query. We will then provide you more information about your query along with code.