Too Many Table Rows

Hi,
I am trying to populate 3 tables in a Word Doc each will contain 20 rows of data. I managed to get the first table working ok but when i tried to do the second one extra rows were added to both of the tables, so im just wondering if anyone has any ideas why this is happening
Thanks in advance
Tim

Hi
Thanks for your request. Could you please attach your template for testing? I will try to help you.
Best regards,

Hi,
Any help would be appreciated please find the template attached…
Tim

Hi
Thanks for additional information. Please try using the attached template and let me know if this helps.
Best regards.

Hi,
The first 2 tables are populating now so ill try the third but i cant see what changes you have made if any, could you let me know.
Thanks alot for your help its appreciated
Regards
Tim

Hi
Note that two regions cannot start/end in the same paragraph or occupy the same table row. So I have split your single table and inserted parts of table into the table cells. To see changes you can disable Hide Gridlines in Word (Table\Hide Gridlines).
Best regards.

Hi,
Ok i understand you now nice one thanks again man…
Regards
Tim

Hi,
Thanks for all your help but I am still having the same problems when i try to add in some extra tables to the document, the first 2 tables are still workin fine but for some reason i cannot replicate them, any help would be appreciated
Thanks again
Tim

Hi
Thanks for your request. It seems that your template works fine on my side. I attached simple application that I have used for testing.
Hope this helps.
Best regards.

Hi,
Are you sure all the tables in the document are populating because when i try to populate the extra 9 i have added only the first 2 seem to work ok.
Thanks
Tim

Hi
Yes, I am sure that all the tables in the document are populating. Have you tried to use my code for testing? Also you can attach your output document for investigating.
Best regards.

Hi,
Thanks alot for your help I took a look at your code and managed to fix my problem, but i have one last question. Is it possible to highlight a specific row in these tables
Thanks again
Tim

Hi
Yes, you can do this. I think that you can try using MergeField event. For example see the following code.

//open template
Document doc = new Document(@"in.doc");
doc.MailMerge.MergeField += new Aspose.Words.Reporting.MergeFieldEventHandler(MailMerge_MergeField);
//Execute mailmerge
doc.MailMerge.ExecuteWithRegions(ds);
//Save output.
doc.Save(@"out.doc");
static void MailMerge_MergeField(object sender, Aspose.Words.Reporting.MergeFieldEventArgs e)
{
    if (e.FieldName == "Rank")
    {
        if (System.Convert.ToInt32(e.FieldValue) == 5)
        {
            Row row = (e.Field.Start.ParentParagraph.ParentNode as Cell).ParentRow;
            foreach (Cell cell in row.Cells)
            {
                cell.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.Yellow;
            }
        }
    }
}

Also see the following links to learn more about MergeField event.
https://reference.aspose.com/words/net/aspose.words.mailmerging/ifieldmergingcallback/
I hope this could help you.
Best regards.