Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How do I create a TppLabel at run time and assign it to the Headerband ?

edited October 2006 in General

I'm getting an access violation with the following code. I'm trying to
create a TppLabel at run time and place it on a HeaderBand.


x:= 6615;

for i :=0 to Grid.Colcount-1 do
begin
ppLabel := TppLabel.Create(ppReport2.Headerband);
With ppLabel do
begin
UserName := Grid.Cells[i, 0];
Border.BorderPositions := [];
Border.Color := clBlack;
Border.Style := psSolid;
Border.Visible := False;
Caption := Grid.Cells[i, 0];
Font.Charset := DEFAULT_CHARSET;
Font.Color := clBlack;
Font.Name := 'Arial';
Font.Size := 8;
Font.Style := [];
Transparent := True;
Height := 3528;
Left := x;
Top := 3969;
Width := 8043;
Visible := True;

ppReport2.Headerband.AddObject(pplabel);
end;
inc(x, 25000);
end;

ppreport2.print;

Comments

This discussion has been closed.