DocumentDataGetFieldsByName Method
Returns the collection of field data where the name is equal to fieldName.

Namespace: GroupDocs.Parser.Data
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 21.5.0
Syntax
public IList<FieldData> GetFieldsByName(
	string fieldName
)

Parameters

fieldName
Type: SystemString
The name of the field.

Return Value

Type: IListFieldData
A collection of FieldData objects; empty collection if no field data is found.
Examples

Find fields by a field name:

C#
// Get all the fields with "Address" name
IList<FieldData> addressFields = data.GetFieldsByName("Address");
if(addressFields.Count == 0) {
    Console.WriteLine("Address not found");
}
else {
    Console.WriteLine("Address");
    // Iterate over the fields collection
    for (int i = 0; i < addressFields.Count; i++) {
        PageTextArea area = addressFields[i].PageArea as PageTextArea;
        Console.WriteLine(area == null ? "Not a template field" : area.Text);       

        // If it's a related field:
        if(addressFields[i].LinkedField != null) {
            Console.Write("Linked to ");
            PageTextArea linkedArea = addressFields[i].LinkedField.PageArea as PageTextArea;
            Console.WriteLine(area == null ? "Not a template field" : area.Text);           
        }
    }
}

FieldData class represents field data. Depending on the field PageArea property can contain any of the inheritors of PageArea class. For example, ParseForm method extracts only text fields.

See Also