Τεκμηρίωση HotXLS

AfterTitle γεγονός

Occurs after the column title specified by FieldIndex is saved into the cell

Περιγραφή

You can use this event to apply conditional formatting to any header cell

Σύνταξη

TAfterTitle = procedure(Sender: TObject; Cell: IXLSRange; FieldIndex: Integer; Field: TField) of object;
Sender TObject. Καθορίζει the TDataToXLS component that triggered the event
Cell IXLSRange which represents the cell with the column title
FieldIndex Integer. The index of the field
Field TField. An object that represents the field of dataset

Παράδειγμα

This example sets the width of the column with index 2

procedure TForm1.DataToXLS1AfterTitle(Sender: TObject;
  Cell: IXLSRange; FieldIndex: Integer; Field: TField);
begin
  if FieldIndex = 2 then Cell.ColumnWidth := 30;
end;
This example shows how to change the text of column title

procedure TForm1.DataToXLS1AfterTitle(Sender: TObject;
  Cell: IXLSRange; FieldIndex: Integer; Field: TField);
begin
  Cell.Value := StringReplace(Cell.Value, '_', ' ', [rfReplaceAll]);
end;