<< Click to Display Table of Contents >> Navigation: Programming > Mail Merge (replace fields with data) and data forms > Create Field > InputMergeField |
To create a field use the procedure InputMergeField
function InputMergeField(
const FieldName: string;
const DisplayText: string = '';
Command: string = '';
Format: Integer = 0;
DisplayChar: Char = #0 //<-- obsolete parameter!
): TWPTextObj;
The parameters are:
FieldName = the name of the field. Will be stored in TWPTextObj.Name
DisplayText = the text which will be placed inside the field. Will be stored in TWPTextObj.Params. Can be modified in the editor.
Command = any text which will be stored in TWPTextObj.Source
Format = any integer which will be stored in TWPTextOnj.IParam
DisplayChar should be not used anymore.
The result of this function is a reference to the TWPTextObj which marks the start of the field.
Please note, a merge field always consists of two object, a start and an end object. Only the start object contains the properties of the field.
WPTextObj instances can be deleted and restored at any time by the editor. It is not recommended to save the references in a list. To fill a list with reference to field objects you can use the procedure FieldGetList at any time. You can also use the 'Code' API with field objects - for example the procedure CodeListTags. (See reference, HLP)