VAR
A:ARRAY OF STRING;
I:INTEGER;
begin
WITH DBGRID,EXCELdo
// EXECL is olevariant your define
begin
SETLENGTH(A,COLUMNS.COUNT);
FOR I:=1 TO COLUMNS.COUNTdo
begin
A:=COLUMN.FIELD.NAME;
CELLS[1,I].VALUE=COLUMN.CAPTION;
end;
DATASET.DISABLECONTROLS;
I:=2;
DATASET.FIRST;
FOR J:=1 TO DATASET.RECORDCOUNT;
begin
CELLS[I,J].VAULE:=DATASET.FILEDBYNAME(A[J]);
I:=i+1;
NEXT;
end;
DATASET.ENABLECONTROLS;
end;
end;