Free Support Forum - aspose.com

GetFieldNames Not Working

I am using this code to determine if there are tablestart and/or tableend fields. The GetFieldNames method is picking up all fields except the regions. Please compare this code to the attached document and let me know why.

Dim arr() As String = doc.MailMerge.GetFieldNames
Dim indexStart As Integer = 0
Dim indexEnd As Integer = 0
For i As Integer = StartHere To arr.Length - 1
If arr(i).ToLower.Contains("tablestart") Then
indexStart = i
End If

If arr(i).ToLower.Contains("tableend") Then
indexEnd = i
Exit For
End If
Next

Thank You!

Hi

Thanks for your inquiry. It seems that this code works fine on my side. I get the following field names using GetFieldNames method.

Dim arr() As String = doc.MailMerge.GetFieldNames()

TableStart:$PW

PolicyNumber

TableEnd:$PW

TableStart:$PW

Name

Address

Address2

City

State

Zip

TableEnd:$PW

Best regards.

Can you test in version 4.2.5?

Solved the problem on my own. Thank you.