We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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?



Thanks for your request. It works, but you should call doc.MailMerge.ExecuteWithRegions(table1) several times. You can use the followin 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")





for (int i = 0; i < count; i++)





I hope that it will help you.

Could you show this code in VB.Net?


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


Next i


Best regards.