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.
Note
We do not provide code for retrieving weather information. You can implement a custom weather information provider.
A MERGEFIELD field defines a location. The field is included as an argument in the DOCVARIABLE field. When the DOCVARIABLE field is updated, the Document.CalculateDocumentVariable event is triggered. A code within the event handler obtains the weather information. The e.VariableName property gets the name of the variable in the field, the e.Arguments property gets the location, and the e.Value property returns the calculated result.
The MailMergeRecordStarted event is handled to insert a hidden text that indicates when the document is created.
- Program.cs (VB: Program.vb)
(you will be redirected to DevExpress.com to submit your response)