FieldAddressBlockGetFieldNames Method
Returns a collection of mail merge field names used by the field.

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
public string[] GetFieldNames()

Return Value

Type: String
Shows how to get mail merge field names used by the field
Document doc = new Document(MyDir + "MailMerge.GetFieldNames.docx");

string[] addressFieldsExpect =
    "Company", "First Name", "Middle Name", "Last Name", "Suffix", "Address 1", "City", "State",
    "Country or Region", "Postal Code"

FieldAddressBlock addressBlockField = (FieldAddressBlock) doc.Range.Fields[0];
string[] addressBlockFieldNames = addressBlockField.GetFieldNames();
See Also