在寫入特定欄位值之前發生,允許在匯出前自訂值的轉換或格式化
語法
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。指定觸發事件的 TDataToXLS 元件 |
| DataSet |
TDataSet。提供目前記錄的資料集 |
| Field |
TField。即將寫入值的欄位 |
| Level |
Integer。主資料集為 0,巢狀明細資料集為更大的值 |
| SourceFieldIndex |
Integer。Field 在 DataSet.Fields 中的從 0 起算索引 |
| ExportColumnIndex |
Integer。目的欄在已匯出欄位中的從 0 起算索引 |
| Value |
Variant。將要寫入的值;指派替代值即可變更 |
| ExportValue |
Boolean。設為 False 讓儲存格留空;True 則寫入 Value |
範例
DataToXLS.BeforeValue := MyBeforeValueHandler;