ExecuteWithRegions with duplicate references to same datatable in a Word doc

Is it ok to have data from the same datatable in two (or more) places in a Word doc (with the same TableStart/TableEnd tag name)? Will a single call to ExecuteWithRegions populate the document in those 2 places with data from the same/single datatable?

TIA,
John

Hi
Thanks for your request. It works, but you should call doc.MailMerge.ExecuteWithRegions(table1) several times. You can use the following code to do it.

string[] arr = doc.MailMerge.GetFieldNames();
int count = 0;
for (int i = 0; i < arr.Length; i++)
{
    if (arr[i] == "TableStart:table")
    {
        count++;
    }
}
for (int i = 0; i < count; i++)
{
    doc.MailMerge.ExecuteWithRegions(table1);
}
doc.Save(@"101_90873_jvsbritto\out.doc");

I hope that it will help you.

Could you show this code in VB.Net?

Hi
Here is the code in VB.Net.

Dim doc As Aspose.Words.Document = New Aspose.Words.Document("in.doc")
Dim arr As String() = doc.MailMerge.GetFieldNames()
Dim count As Integer = 0
Dim i As Integer
For i = 0 To arr.Length - 1
If arr(i) = "TableStart:table" Then
count = count + 1
End If
Next i
For i = 0 To count - 1
doc.MailMerge.ExecuteWithRegions(table1)
Next i
doc.Save("out.doc")

Best regards.