Implementing a FORMTEXT Class

The FormText field is used in MS Word to create fillable documents. In many applications, such documents are automated, so that these fields must be readable to be completed automatically. An ApplicationField object acts like a container for all settings (switches) of these fields.

In contrast to the first example, this sample implements a class for the FormText fields that is not inherited from the TextField base class. In this case, no separate collection is required to synchronize these fields. Everytime, an ApplicationField of type FORMTEXT should be edited, a new FormText object is created:

[C#]
FormText curFormText = new FormText(textControl1.ApplicationFields.GetItem());
[Visual Basic]
Dim curFormText As New FormText(TextControl1.ApplicationFields.GetItem())

A reference to the ApplicationField is stored in the FormText instance. Similar to the first sample, this ApplicationField is used to get or set the parameters that are mapped to the properties of the new implemented FormText object.

A dialog box is implemented to change the properties of the specific form text field. The dialog represents the properties of the implemented FormText field:

After clicking OK, the specified values in the dialog box are set in the implemented FormText object which writes the parameters of the referenced ApplicationField.

<< Previous Next >>