Object model

Specifics of the used object model are described below.

Working with collections

All collections in the object model support the following methods:

Name Type Access Description
Count int Read-only The number of items in the collection
Item( index : int ) ItemInterface Read-only

Retrieves an item of the collection with the given index.

Enumeration begins with "0".

Note: Instead of using the method Item you can also address items of the collection using parentheses or square brackets depending on the selected language. In JScript, VBScript and Visual Basic.Net languages, parentheses are used. In C#.Net it is only possible to use square brackets. In JScript.Net both parentheses and square brackets can be used.

For example,

Items( 1 ).Text = "Hello" or Items[ 1 ].Text = "Hello"

All collections can be used in "for each" and similar constructs.

Working with recurring fields and tables

All document fields except tables can be recurring.

In the document structure recurring fields are represented with a special prototype field which has a nonempty Items collection.

A prototype field has neither child items nor value. It is used only for storing the set of the field iterations. Child fields and/or field values can be attributes of the field instances only, which are available through the Items method of the IField object.

Tables always have the Rows collection (Rows is the synonym of Items). The Rows collection contains only those rows of the table whose cells can be accessed through the method Children of the rows.

Composing paths to fields

Field, HasField and IndexedItemValue methods of the IDocument object use paths to the fields on the form as their parameters. The formal way to represent the path with a BNF (Backus-Naur Form) is as follows:

<Path> ::= <Path_component> | <Path> "\" <Path_component>

<Path_component> ::= <Field_name> | <Field_name> "["<Field_iteration_number>"]"

Where Field_name indicates the names of the document fields as they are defined in Document Definition and Field_iteration_number is the iteration number of the recurring field (the row number for tables) beginning from "0".

The path can be full or relative. Full paths are constructed beginning with the name of the document section, while relative paths are constructed beginning with the name of the child item in the group.

For example, to address the third row of the column "Total" in the table "Table", which is located in the section "Section" you should write the following:

"Section\Table[2]\Total"

Such a full name can be constructed by means of the FullName method of the IField object.

25.05.2023 7:55:02

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.