Mailmerge Category

[Top]  [Chapter]  [Previous]  [Next]

Update and read out data fields in the text. (See Introduction)


The mailmerge process offered by TextDynamic is one of its most popular features.


It updates the text inside certain field objects. It can also update image objects.


Since the fields are usually not deleted by the update process it is possible to update the data later again. Mail merge is more than just search & replace.


It is also possible to read out the text in case the user has edited it. Like hyperlinks merge fields use paired objects. One object marks the start of the field, the other the end. The text within is the "embedded text".


You can customize the component to show or hide the field markers (SpecialTextAttr(wpInsertpoints).Hidden). It is also possible to display a single object only which shows the name of the field. (property IWPMemo.ShowFields)


The merge process is started with IWPMemo.MergeText("").

You need to create an event handler for OnFieldGetText to insert the data into the field.


Mail merge fields are implemented using paired text objects. Using InputField and CurrObj.Mode=2 you can create an "Edit Field" which can be changed in form completion mode while the rest of the text is protected.



IWPMemo.CurrObj this is the field which was added using InputField last.


The event OnFieldGetText receives a reference to IWPFieldContents which contains many properties.




Note: The field markers « and » are usually visible. To hide the markers use


Memo.SpecialTextAttr(wpInsertpoints).Hidden = True


Also see:

Command ID 16 - Syntax Highlighting - highlight tokens, i.e. <<name>>


Command ID 17 - Token To Template Conversion - convert tokens to fields


Command ID 15 - Update ShowFields Mode - display field names instead of « and ».

[idh_cat_mailmerge.htm]    Copyright © 2007 by WPCubed GmbH