Quantcast
Viewing all articles
Browse latest Browse all 7205

How to use document variable (DOCVARIABLE) fields

This example illustrates the use of a DOCVARIABLE field to provide additional information which is dependent on the value of a merged field. This technique is implemented so each merged document contains a weather report for a location that corresponds to the current data record.

NB: We do not provide code for retrieving weather information. You can implement a custom weather information provider.

The location is represented by a merge field. It is included as an argument within the DOCVARIABLE field. When the DOCVARIABLE field is updated, the DevExpress.XtraRichEdit.API.Native.Document.CalculateDocumentVariable event is triggered. A code within the event handler obtains the information on weather. It uses e.VariableName to get the name of the variable within the field, e.Arguments to get the location and returns the calculated result in e.Value property.
The MailMergeRecordStarted event is handled to insert a hidden text indicating when the document is created. 
The MyProgressIndicatorService class is implemented and registered as a service to allow progress indication using the ProgressBar control.


Viewing all articles
Browse latest Browse all 7205

Trending Articles