Nested Mail Merge regions feature

The latest version says that nested regions are supported in Aspose.Words. Here is a scenario which has to be implemented. The table we have is similar to the below mentioned table
MERGEFIELD TableStart: ParentRegion

Static Row 1
Static Row 2
Static Row 3
TableEnd: First Child
Static Row 4

MERGEFIELD TableEnd:ParentRegion
As it is evident, the 4th row of the table has to be iterated in case of multiple entries in the datasource passed to that region. Here are a couple assumptions which need to confirmation

  1. A separate datasource should be passed to the region whose name is First Child

  2. The iteration of the nested region will happen as many times as the entities in the data source and the 4th static row be the last row in the table after the itereated First Child’s entries.

  3. If the datasource of Parent Region has mutliple entities, Will the entire table be repeated?
    4.Is there any demo source code that shows a similar implementation of this feature.

Any help in this regard is highly appreciated.
Thanks and Regards,
Pavithra V S


Thanks for your request. I created simple example for you. Sample template and output document are attached, Here is code:

// Open template.
Document doc = new Document(@"Test001\in.doc");
// Execute mail merge with regions.
// Save output document.
/// Returns dummy datasource, which contaion two tables with parent-child relationships.
/// The first table name is "ParentRegion", the child table name is "ChildRegion".
private static DataSet GetData()
    DataSet ds = new DataSet();
    // Create two tables and add them into the data set.
    DataTable parent = new DataTable("ParentRegion");
    DataTable child = new DataTable("ChildRegion");
    child.Columns.Add("parnetId"); // this column is needed to create relationshoip between tables.
    // Add tables into the data set and add relationship.
    ds.Relations.Add(parent.Columns["id"], child.Columns["parnetId"]);
    // Structure of our datasource is ready. Let's add some dummy data.
    Random rnd = new Random();
    for (int i = 0; i < 10; i++)
        parent.Rows.Add(new object[]
        string.Format("Parent Name #{0}", i)
        for (int j = 0; j < rnd.Next(1, 15); j++)
            child.Rows.Add(new object[]
            string.Format("child {0} {1}", i, j),
            string.Format("description of child {0} {1}", i, j)
    return ds;

Hope this helps. Also, please see the following blog to learn more about this feature:
Best regards.

Thank you so much for the very quick reply!

Is the’ nested regions’ feature supported by the latest update of Aspose.words for java ? Because, it throws an error saying

Found mail merge region ‘SLA01’ nested in another mail merge region ‘SLA01’. Nested mail merge regions are not yet supported
Please let me know which updated version should I be using in order to get away with this error.

Thanks and Regards,
Pavithra V S


Thanks for your request. At the moment nested regions are supported in .NET version of Aspose.Words only. I will notify you as soon as this feature is available in Aspose.Words for Java.
Best regards.

Hi Alexey,
Could you please say when the feature is expected in Java version of Aspose.Words?
Best regards, Evgeniy


Thanks for your inquiry. Hopefully, this feature will be available in Aspose.Words for Java somewhere in February. You will be notified as soon as it is supported.
Best regards,

The issues you have found earlier (filed as 12928) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.