I would do something like this
First clean the strips in the grid
for I := 0 to YourGrid.bands.count-1
YourGrid.bands[I].Free;
Then you create title bars
CreateBands('Prime key Header',YourGrid);
CreateBands('Main Title 1 Header',YourGrid);
CreateBands('Main Title 2 Header',YourGrid);
Then you connect your columns to the group index
for I := 0 to YourGrid.ColumnCount - 1 do
begin
if (YourGrid.Columns[I].Caption = 'prim_key') then
YourGrid.Columns[I].Position.BandIndex := 0
end;
source
share