We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Support for Rules / Word field for Aspose Java

I have a template with the word field “Merge Record#” inserted. All the remaining fields are merged properly with the values passed dynamically, but not the above word field.

Does Aspose java supports these kind of fields? If yes could you please provide the link to the example page or provide me the code to be used.

The steps we inserted the word field in 2003 are

(1) Open the template
(2) Click on Tools~ > Letters and Mailings ~> Mail Merge
(3) The icon of “Insert Word Field” will be shown on the Mail Merge Tool Bar
(4) Move the cursor to where you want to put in the rule
(5) Click on Insert Word Field DropDown and select the item you want.

Thanks in advance


Thanks for your inquiry. What you are asking for is MailMerge feature. Please follow the links to learn more about MailMerge feature in Aspose.Words:



Please let me know in case of any issues, I will be glad to help you.

Best regards,


Thanks for your quick reply. We are using Aspose java for the merging purpose. All the placeholder field values are replaced with the respective value from the result set, but this is a special field which will not have value in the result set. In this example I used <<merge record #>> which will have a value in the result set. It should be automatically replaced with the merge record number for every document generated using Java.

Thanks again.


Thank you for additional information. Could you please attach your template document here for testing? I will check in on my side and provide you more information.

Best regards,

Hi Andrey,

I have attached the sample template. The fields FolderNo and Description are merged properly with the resultset we got from the DB, but the rules Merge Record # and Merge Sequence # are not replaced with respective values.

Could you please check and let me know if i need to add any code block to support these fields?

Thanks for your time.


Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java 10.6.0. I use the following code for testing.

Document doc = new Document("C:\\Temp\\SingleMergeTemplate.doc");

String[] fields = { "FolderRSN", "FolderDescription" };

String[] values = { "value1", "value2" };

doc.getMailMerge().execute(fields, values);


Best regards,