Occurs after the specified by ColumnIndex column of the current row is saved into the Excel cell.
Description
You can use this event to apply conditional formatting to any exported cell in the detail area.
Syntax
TDBGridAfterDetailCell =
procedure (Sender: TObject; Cell:
IXLSRange; RowIndex, ColumnIndex: integer; Column: TColumn) of object;
| Sender | TObject. Specifies the TDBGrid2Excel 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 color for odd columns to silver.
procedure TForm1.DBGrid2Excel1AfterDetailCell(Sender: TObject;
Cell: IXLSRange; RowIndex, ColumnIndex: Integer; Column: TColumn);
begin
if Odd(ColumnIndex + 1) then Cell.Interior.Color := ColorToRGB(clSilver);
end;