MergeText Method

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

Start the data merging process fo all or a group of fields.

Applies to

IWPMemo

Declaration

void MergeText([In] string FieldName);

Description

Start the data merging process. The event OnFieldGetText will be triggered for each mail merge field.

 

Mail merge fields can be inserted using IWPTextCursor.InputField.

 

It is also possible to use bookmarks and hyperlinks as merge fields. This makes it possible to perform nested merge operations.

 

To do so, please execute Memo.TextCommand( 26, 2, 0) to merge in hyperlinks, Memo.TextCommand( 26, 3, 0) to merge into bookmarks

and Memo.TextCommand( 26, 1, 0) to use merge fields (default).

 

When you need to create a large document from a letter processed by MergeText for all rows in a RecordSet, i.e. to do mass mailing, use the method Memo2.AppendOtherText. Please initialize TextDynamic in the double editor mode, using SetEditorMode(1,...).

 

If you need to create tables with the contents of a complete RecordSet you can consider to use the internal reporting engine.

 

The field markers << and >> are usually visible. To hide them use

WPDLLInt1.SpecialTextAttr(wpInsertpoints).Hidden = True

Note:

TextDynamic uses standard RTF tags to load and save fields so merge fields inserted in Word are usually available in TextDynamic as well (without the extended attributes). Alternatively you can inserted the tags using escape text, i.e. <name> and use the method IWPTextCursor.FieldsFromTokens(StartText,EndText,FieldPreText) to convert the text into merge fields.

 

Parameter "Name":

This is the name of the fields to be merged. You can use the wildcard * to process a group of fields, i.e. MergeText("CustomerDB.*").

 

Please also see Category Mailmerge and the "Mail merge API introduction".

An alternative to do mail merge uses the method TextCursor.CPMoveNextObject

Here you can specify 1 for ObjType to find the merge fields.

You can then use CurrObj to update the data according to CurrObj.Name.

 

 


[idh_iwpmemo_mergetext.htm]    Copyright © 2007 by WPCubed GmbH