TWPMMDataProvider

<< Click to Display Table of Contents >>

Navigation:  Programming > Mail Merge (replace fields with data) and data forms >

TWPMMDataProvider

The component TWPMMDataProvider establishes an automatic link between a mail merge or editfield form to a datasource.

 

property Datasource: TDatasource

property EditBox: TWPCustomRichText

This properties connect to a data source and a WPTools Editor, i.e. a TWPRichText.:

 

property BooleanConversion : TWPMMBooleanConversion

If this property is not cvStandard, TBooleanFields or fields in the list BoolFields will automatically be displayed and handled as checkbox fields. You need to set the flag wpInteractiveFORMTextObjects in ViewOptionsEx to make the automatically created checkboxes for boolean fields work.

 

property AutoLoadData: Boolean

If this property is true, data will be automatically inserted into mail merge fields. The name of the field must match the field in the dataset. To add additional or calculated data, it is possible to muse the event OnGetTextToInsert.

 

property AutoSaveData: Boolean

If this property is true, data in the fields will be saved to the dataset fields with the same name.

 

property RTFFields: TStrings

property BMPFields: TStrings

property BoolFields: TStrings

This lists tell the component which data type is expected in certain fields. Boolean fields can be strings, "T"/"F" or "true"/"false" but also integers 1/0.

 

If the flag wpmmControlDataInput is used in property Options, the TWPMMDataProvider also controls data input through event OnEditFieldCheckInputString.

 

If the flag wpmmEditfieldSetSize was set, the DataProvider controls the visible field length. The behavior can be further modified with the properties EditFieldMaxCharLength and EditFieldDefaultWidthTwips.

 

The TWPMMDataProvider has been implemented in unit WPDBRich.PAS - we recommend to check out its source code since it contains some useful code examples for dealing with mail merge and edit fields.