Mailmerge Category

Description
"Mail Merge" means the automatic update of data fields in any document. It can be used to do mass mailing or to create customizable database record views.
With WPTools merge fields are not destroyed by the merge process, the field data can be exchanged as soon as it changes. So it is possible to scroll through a database with a merge letter being "attached".
It is also possible to read out the contents of the merge field. So the document can be also used as data entry from.

Mail merge is very easy to use. To create a field use function InputMergeField. To start the mail merge process use MergeText and the event OnMailMergeGetText. The display of the field markers (red characters) can be changed using the property InsertPointTextAttr, they can be also hidden. The display for the merged text can be changed using the property AutomaticTextAttr.

Please also see the functions which work with 'Codes'. "CodeInsideOf" for example can be used to check if the mouse cursor is moved over an embedded mail merge field. Most of the procedures which work with mail merge field use the 'Code' procedures.

When you upgrade from WPTools 4 please note the changes for the following methods:
InputField = InputMergeField - with different parameter list!
ReadFieldText = FieldReadText
GetFields = FieldGetNames
GetPreviousFieldName = FieldGetNameInPar
FastMergeText = MergeText
MergeTextFor = obsolete
MergeTextForName = MergeText(Name)
FastMergeTextFor = obsolete
FastMergeTextForName = MergeText(Name)
MergeCopyText = obsolete
SetFastMode = BeginUpdate/EdnUpdate - usually not required!
Please note that the mail merge works differently than in WPTools 4: Inside the OnMailMergeGetText event you can use InputString to insert text at the cursor position.


Classes
TWPMMInsertTextContents

Methods
TWPCustomRtfEdit.CodeListTags
TWPCustomRtfEdit.CurrentEditField
TWPCustomRtfEdit.DeleteFieldAtCP
TWPCustomRtfEdit.FastAppendText
TWPCustomRtfEdit.FieldAtCP
TWPCustomRtfEdit.FieldExists
TWPCustomRtfEdit.FieldGetInPar
TWPCustomRtfEdit.FieldGetList
TWPCustomRtfEdit.FieldGetNameInPar
TWPCustomRtfEdit.FieldGetNames
TWPCustomRtfEdit.FieldLocate
TWPCustomRtfEdit.FieldReadText
TWPCustomRtfEdit.FieldRename
TWPCustomRtfEdit.InputEditFieldCreates a new mail-merge or edit field.
TWPCustomRtfEdit.InputFieldInputField is not included in WPTools 5 - please use InputMergeField()
TWPCustomRtfEdit.InputMergeFieldCreates a new mail-merge field.
TWPCustomRtfEdit.MergeActiveText
TWPCustomRtfEdit.MergeEnumFields
TWPCustomRtfEdit.MergeText
TWPCustomRtfEdit.MoveToField
TWPCustomRtfEdit.MoveToNextField
TWPCustomRtfEdit.MoveToPreviousField
TWPCustomRtfEdit.ReplaceTokens
TWPCustomRtfEdit.SelectFieldAtCP

Events
TWPCustomRtfEdit.OnInitializedRTFDataThis event can be used to assign the same TWPRTFProps object to different editors.
TWPCustomRtfEdit.OnMailMergeGetTextThis event is triggered when the MergeText or MergeEnumFields procedure is used.
You can use the provided parameter inspname to select the required result string for the property Contents.StringValue.

Contents.StringValue := Table1.FieldByName(inspname).AsString;
TWPRichText.OnInitializedRTFDataThis event can be used to assign the same TWPRTFProps object to different editors.
TWPRichText.OnMailMergeGetTextThis event is triggered when the MergeText or MergeEnumFields procedure is used.
You can use the provided parameter inspname to select the required result string for the property Contents.StringValue.

Contents.StringValue := Table1.FieldByName(inspname).AsString;


Copyright (C) by WPCUBED GmbH - Munich
http://www.wpcubed.com