Use TWPMMDataProvider

<< Click to Display Table of Contents >>

Navigation:  Programming > Mail Merge (replace fields with data) and data forms > Update Field (Insert Text from Database) >

Use TWPMMDataProvider

This component can be used to automatically attach a mail merge template to a data set. The property NextDataProvider can be used to build a chain of data provider.

 

The event OnGetDataSet can be used to locate the correct dataset for a given field. (i.e. evaluate Contents.DataSetNamePart)

 

Fieldsnames which are listed in the list BMPFields are expected to be pictures, the fields in RTFFields are expected to contain formatting tags.

 

If a field is of type TGraphicField, automatically the contained image will be inserted. Here the flag wpmmPreserveObjectSize can be used in property "Options" to load the image into the current container (if there is one).

 

Info: The data merging is performed by

 

procedure TWPMMDataProvider.DoMergeGetText(Sender: TObject;

const fieldname: string;

 Contents: TWPMMInsertTextContents);

 

found in unit wpdbrich.pas. We recommend to read it.