com.groupdocs.parser.data

Class FieldData



  • public class FieldData
    extends Object
    Represents field data such as a name, a page index, a field value and so on. Depending on the field the value can be a text, an image, a table and so on.

    The instances of FieldData class are used in DocumentData collection.

    • Constructor Detail

      • FieldData

        public FieldData(String name,
                         PageArea pageArea)
        Initializes a new instance of the FieldData class.
        Parameters:
        name - The name of the field.
        pageArea - The value of the field.
      • FieldData

        public FieldData(String name,
                         PageArea pageArea,
                         FieldData linkedField)
        Initializes a new instance of the FieldData class.
        Parameters:
        name - The name of the field.
        pageArea - The value of the field.
        linkedField - The field which is linked to the field.
    • Method Detail

      • getName

        public String getName()
        Gets the field name.
        Returns:
        An uppercase string value that represents the name of the field.
      • getPageIndex

        public int getPageIndex()
        Gets the page index.
        Returns:
        A zero-based index of the page that contains the field.
      • getPageArea

        public PageArea getPageArea()
        Gets the value of the field.

        Depending on field PageArea property can contain any of the inheritors of PageArea class. For example, Parser.parseForm() method extracts only text fields.

         PageTextArea area = field.getPageArea() instanceof PageTextArea
                 ? (PageTextArea) field.getPageArea()
                 : null;
         System.out.println(area == null ? "Not a template field" : area.getText());
         
        Returns:
        An instance of PageArea class that represents the value of the field.
      • getLinkedField

        public FieldData getLinkedField()
        Gets the linked field.
        Returns:
        An instance of FieldData class that represents the field which is linked to the field; null if it isn't set.
      • getText

        public String getText()
        Gets the text.
        Returns:
        A string value that represents a value of the field text; null if PageArea property isn't PageTextArea.