เอกสาร HotXLS

อีเวนต์ AfterTitle

เกิดขึ้นหลังจากบันทึกชื่อคอลัมน์ที่ระบุโดย FieldIndex ลงในเซลล์

ไวยากรณ์

ตัวอย่างนี้แสดงวิธีใช้อีเวนต์ AfterTitle

ตัวอย่าง

TAfterTitle = procedure(Sender: TObject; Cell: IXLSRange; FieldIndex: Integer; Field: TField) of object;
Sender TObject. ระบุ TDataToXLS component that triggered event
Cell IXLSRange which represents เซลล์ พร้อม คอลัมน์ title
FieldIndex Integer. ดัชนี ของ field
Field TField. object that represents field ของ 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;