Skip to main content
All docs
V24.1

XRTextBox.CalculateDocumentVariable Event

Occurs during export and allows you to customize DOCVARIABLE fields added to the Textbox item content.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

public event CalculateDocumentVariableEventHandler CalculateDocumentVariable

Event Data

The CalculateDocumentVariable event's data class is CalculateDocumentVariableEventArgs. The following properties provide information specific to this event:

Property Description
Arguments Provides access to a collection of arguments within the DOCVARIABLE field.
FieldLocked Gets or sets a locked attribute to the field for which the event occurs.
Handled Gets or sets whether the default action is required.
KeepLastParagraph Gets or sets whether the last paragraph of the inserted document is kept in the resulting document.
PreserveInsertedContentFormatting Gets or sets whether to insert an additional hidden paragraph so that the inserted content is not formatted with the DOCVARIABLE field’s paragraph formatting.
Value Gets or sets the value of the DOCVARIABLE field that fired the event.
VariableName Gets the name of the document variable to which the DOCVARIABLE field refers.

Remarks

The code snippet below demonstrates how to handle the CalculateDocumentVariable event to add custom text to the Exporter DOCVARIABLE field’s value:

using DevExpress.DashboardCommon;
using DevExpress.XtraReports.UI;
using System.Collections.Generic;
using System.Windows.Forms;
//...
private void DashboardDesigner_CustomExport(object sender, CustomExportEventArgs e){
    foreach (KeyValuePair<string, XRControl> xrControl in e.GetPrintableControls()){
        XRTextBox xrTextBox = xrControl.Value as XRTextBox;
        if (xrTextBox != null){
            xrTextBox.CalculateDocumentVariable += OnCalculateDocumentVariable;
        }
    }
}
private void OnCalculateDocumentVariable(object sender, DevExpress.XtraRichEdit.CalculateDocumentVariableEventArgs e){
    if(e.VariableName=="DataItem0")
        e.Value += " (Custom text for Exporter)";
}

Custom Export TextBox

See Also