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 geocoordinates for a location that corresponds to the current data record.
Note
We do not provide code for retrieving geocoding and weather information, empty data are returned instead. You can implement a custom geocoordinate and 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 Document.CalculateDocumentVariable event is triggered. A code within the event handler obtains the information on geocoordinates. 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. To display hidden text and all non-printing characters, use the CTRL-SHIFT-8 key combination.
The MyProgressIndicatorService
class is implemented and registered as a service to allow progress indication using the ProgressBar control.
- GeoLocation.cs (VB: GeoLocation.vb)
- MainWindow.xaml (VB: MainWindow.xaml)
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
- MyProgressIndicator.cs (VB: MyProgressIndicator.vb)
(you will be redirected to DevExpress.com to submit your response)