FormDef object
Typically, this method is used together with CreateFormDefFromFile when you are automating the process of creating form definitions. It creates a field definition on the form definition. If successful, the method returns a FieldDef object. If not, an empty VARIANT is returned.
|
Parameter |
Description |
|
Name |
Specifies the name of the field. The name must be a valid field name. Field names can have up to 11 characters and consist of numbers, letters of the alphabet, and underscore ( _ ). However, field names must begin with a letter, and "CR_LF" is not allowed because this is the name of a predefined transaction field. |
|
FieldType |
Specifies the type of field. Choose one of these values: 1 = Character field. This is the most common field type. 2 = Adjustment field 3 = Recognition field 4 = Image field 5 = Mark field 6 = Object field 7 = Barcode field 8 = Copy field 11 = Data field |
|
Index |
Specifies the index of the field being created. (See FORMS Help if you are unsure of what a field index is.) |
|
PageNo |
Specifies whether the field is to be created on the front or back page of the form definition: 1 for the front (even if the form definition is one-sided) or 2 for the back. |
|
XPos, YPos |
Specifies the position of the upper left corner of the field in pixels. |
|
Width, Height |
Specifies the width and height of the field, in pixels. |
|
DrawMode |
Specifies the way that the field is drawn. Choose one of the following values: 1 = Hand-drawn field (no support lines). This is the least dependable field drawing mode. 2 = Support lines. The area surrounding the rectangle is scanned for support lines. The field "snaps" to any lines found in the area. If no support lines are found, the field becomes a hand-drawn field. 3 = Double-clicked field. The field is expected to be surrounded by support lines. This is the safest field type. The XPos and YPos coordinates should specify a position somewhere inside the field rectangle. Width and Height are not used; set them to zero (0). Note: In the case of hand-drawn fields, FORMS fixes its position on a specific spot on the page, measured from the sides. If you later process an image which is slightly distorted, the field position can differ just enough that FORMS fails to find the field. With double-clicked fields or fields with support lines, FORMS locates the actual lines around the field on each scanned form, which is much more accurate and improves interpretation results. Therefore, use 2 or 3 whenever possible. |
|
Rotation |
Specifies how many degrees the field is to be rotated counter-clockwise. Legal values are 90, 180, and 270. |
|
MatchValue |
(Data type: String.) Corresponds to the field defined when setting up a recognition field in the Manager. If you do not want to use the method to create a recognition field, let MatchValue be an empty string. |
After you create a field, you must save it by calling Save – except if you are creating adjustment fields or recognition fields, as these are saved immediately when created.
This sample code shows how to create a field definition on the current form definition:
Dim oFieldDef As Object
Set oFieldDef = Application.FormDef.CreateField("FieldA",1, 0, 1, 400, 200, 70, 10, 1, 0, "")
oFieldDef.SetFormat("X(2-6)")
oFieldDef.Save()
When you use this method to create a form definition that is to be rotated during the scanning process, the coordinates of the adjustment fields must be supplied as if the form were not rotated. That is, transform the coordinates for adjustment fields to the coordinates they would have been if the form were not rotated. This is due to the fact that the coordinates of the adjustment fields are always saved unrotated in FORMS, to increase the speed of identification when scanning.
Defining field areas (FORMS Help topic)