HotXLS Docs

BeforeValue property

Occurs before a specific field value is written, allowing custom value transformations or formatting prior to export

Syntax

TBeforeValue = procedure(Sender: TObject; DataSet: TDataSet; Field: TField; Level, SourceFieldIndex, ExportColumnIndex: Integer; var Value: Variant; var ExportValue: Boolean) of object; property BeforeValue: TBeforeValue read FBeforeValue write FBeforeValue;
Sender TObject. Specifies the TDataToXLS component that triggered the event
DataSet TDataSet. The dataset that supplies the current record
Field TField. The field whose value is about to be written
Level Integer. Zero for the master dataset and larger values for nested detail datasets
SourceFieldIndex Integer. Zero-based index of Field in DataSet.Fields
ExportColumnIndex Integer. Zero-based index of the destination column among the exported fields
Value Variant. The value that will be written; assign a replacement to change it
ExportValue Boolean. Set to False to leave the cell empty; True writes Value

Example

This example hooks the BeforeValue event handler

DataToXLS.BeforeValue := MyBeforeValueHandler;