HotXLS Docs

AfterCell event

Occurs after the column specified by ColumnIndex of the current row is saved into the cell

Description

You can use this event to apply conditional formatting to any exported cell in the detail area

Syntax

TDBGridAfterCell = procedure (Sender: TObject; Cell: IXLSRange; RowIndex, ColumnIndex: Integer; Column: TColumn) of object;
Sender TObject. Specifies the TGridToXLS component that triggered the event
Cell IXLSRange. Represents the cell which is exported
RowIndex Integer. The index of the current row
ColumnIndex Integer. The index of the column
Column TColumn. An object that represents the column

Example

This example sets the interior colour for odd columns to silver

procedure TForm1.GridToXLS1AfterCell(Sender: TObject;
  Cell: IXLSRange; RowIndex, ColumnIndex: Integer; Column: TColumn);
begin
  if Odd(ColumnIndex + 1) then Cell.Interior.Color := ColorToRGB(clSilver);
end;