Repeating Merge fields in template

HI

We are using Aspose to generate templates and convert them to PDF. We have some scenarios where need to repeat the same merge field across the template. But behavior is code merges only first available field and ignore other fields
Is this a issue or need to have some other setting

thanks

@appuelex Could you please attach your template and code here for testing? We will check the issue and provide you more information.
Upon executing mail merge Aspose.Words fills all fields in the template. For example see the attached template and output document produced by the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.MailMerge.Execute(new string[] { "test" }, new string[] { "This is a merge field value." });
doc.Save(@"C:\Temp\out.pdf");

in.docx (12.1 KB)
out.pdf (16.7 KB)

Hey @appuelex!

you can do like this.

Document doc = new Document(template path);
MailMerge mm = doc.getMailMerge();
mm.setMergeDuplicateRegions(true); // you can set this property
1 Like