How do I create a TppLabel at run time and assign it to the Headerband ?
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;
This discussion has been closed.
Comments
Instead of calling the Band.AddObject routine, you need to set the
TppLabel.Band property. This will add the component to the proper band.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com