NativeExcel suite v2.x

AfterDetailCell event

Occurs after the specified by FieldIndex field of the current record 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

TAfterDetailCell = procedure (Sender: TObject; Cell: IXLSRange; RowIndex, FieldIndex: integer; Field: TField) of object;
SenderTObject. Specifies the TDataset2Excel component that triggered the event.
CellIXLSRange. Represents the cell which is exported.
RowIndexInteger. The index of the current row.
FieldIndexInteger. The index of the field.
FieldTField. An object that represents the field of dataset.

Example

This example sets the interior color for odd columns to silver.
procedure TForm1.Dataset2Excel1AfterDetailCell(Sender: TObject;
  Cell: IXLSRange; RowIndex, FieldIndex: Integer; Field: TField);
begin
  if Odd(FieldIndex + 1) then Cell.Interior.Color := ColorToRGB(clSilver);
end;
Copyright © NikaSoft 2004-2011