Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

DXRichEdit for WPF: How to use document variable (DOCVARIABLE) fields

$
0
0

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.
Coordinates are provided by Google Maps API.
Google services are queried using the string representing location. It contains the value of a corresponding merged field for each merged document.
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 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.



Viewing all articles
Browse latest Browse all 7205

Trending Articles