Page 1 of 1
Merge cells in Band
Posted: Tue Apr 03, 2018 5:45 pm
by 18683214
I want to group columns and have a heading for each group. I thought I would be able to do this with band headers but I can't see any way to do it. Any ideas?
Group 1 | Group 2
-------------------------------------------------------
G1C1 | G1C2 | G1C3 | G2C1 | G2C2 | G2C3
-------------------------------------------------------
Re: Merge cells in Band
Posted: Wed Apr 04, 2018 2:21 pm
by yeray
Hello,
Taking the
Header_Footer example, this seems to work fine for me here:
Code: Select all
type
THouse=record
public
Address : String;
Floors : Integer;
end;
TPerson=record
public
Name : String;
Phone : Integer;
end;
TPropriety=record
public
House: THouse;
Owner: TPerson;
end;
var
Proprieties : TArray<TPropriety>;
procedure TFormHeaderFooter.FormCreate(Sender: TObject);
begin
SetLength(Proprieties,2);
Proprieties[0].House.Address:='123 St';
Proprieties[0].House.Floors:=5;
Proprieties[0].Owner.Name:='John';
Proprieties[0].Owner.Phone:=666777888;
Proprieties[1].House.Address:='456 St';
Proprieties[1].House.Floors:=2;
Proprieties[1].Owner.Name:='Marc';
Proprieties[1].Owner.Phone:=666777666;
TeeGrid1.Data:=TVirtualData<TArray<TPropriety>>.Create(Proprieties);
end;
- TeeGrid_Header_Footer_2018-04-04_16-19-12.png (4.3 KiB) Viewed 19696 times
Re: Merge cells in Band
Posted: Wed Apr 04, 2018 3:16 pm
by 18683214
That does work (except for the column lines in the header). But, it is done completely automatically. My data does not fit that model so I want to know how to do that using code?
In the process of trying to figure out how to change the header text, I deleted the only entry in the "Headers" collection of the TeeGrid component. This caused unrecoverable errors in the IDE. Should I file a bug report?
Re: Merge cells in Band
Posted: Tue Apr 10, 2018 7:05 am
by yeray
Hello,
Koot33 wrote:That does work (except for the column lines in the header). But, it is done completely automatically. My data does not fit that model so I want to know how to do that using code?
We are investigating the options available to do this. We'll be back to you asap here.
Koot33 wrote:In the process of trying to figure out how to change the header text, I deleted the only entry in the "Headers" collection of the TeeGrid component. This caused unrecoverable errors in the IDE. Should I file a bug report?
I've just added it to the public tracker. Thanks for reporting it.
http://bugs.teechart.net/show_bug.cgi?id=2026
Re: Merge cells in Band
Posted: Wed Apr 18, 2018 1:43 pm
by yeray
Hello,
Koot33 wrote:except for the column lines in the header
You could set the format brush to paint above that line. In the same example:
Code: Select all
TeeGrid1.Columns[0].Header.ParentFormat:=False;
TeeGrid1.Columns[0].Header.Format.Brush.Visible:=True;
TeeGrid1.Columns[0].Header.Format.Brush.Color:=clGray;
TeeGrid1.Columns[1].Header.ParentFormat:=False;
TeeGrid1.Columns[1].Header.Format.Brush.Visible:=True;
TeeGrid1.Columns[1].Header.Format.Brush.Color:=clGray;
- TeeGrid_Header_Footer_2018-04-18_14-56-13.png (3.99 KiB) Viewed 19541 times
Koot33 wrote:But, it is done completely automatically. My data does not fit that model so I want to know how to do that using code?
Still investigating the options we have for doing this manually.
Re: Merge cells in Band
Posted: Tue Apr 24, 2018 1:40 pm
by yeray
Hello,
Yeray wrote:
Koot33 wrote:But, it is done completely automatically. My data does not fit that model so I want to know how to do that using code?
Still investigating the options we have for doing this manually.
As TeeGrid is designed, you only can have subcolumns using a TVirtualData array with an structure of records and subrecords as in the
Header_Footer example I mentioned in my first reply in this thread.
I've made an example of doing the same with a database
here.