Free Support Forum -

Mail Merge an array of objects with regions


I have an array of custom C# objects which I would like to mail merge into a table in a Word template. The documentation and only overloads I can find all require an ADO.NET data source. Is there any way I can merge my object array into a repeat block?


This message was posted using Page2Forum from How-to: Execute Mail Merge with Regions - Aspose.Words for .NET and Java

That works great, thanks Alexey.

Following in from that, let’s say my object are people and I want an array of them to come out in a comma-separated list in the document. At the moment I have:


Despite all being one line, the names come out one on each line like this.
Can I make it come out like this?

Alice, Bob, Eve


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. If you know number of records in your data source, you can try using NEXT fields. But, in your case, I suppose, number of values is dynamic. So I think, you can build this string in the code and insert it into the mergefield.

Best regards.