Home Subreports

Simple dynamic report

edited September 2003 in Subreports
Am trying to create dynamic subreports(Printbehaviour = pbSection)
and place labels, images etc within it. There are no dbcontrols or
pipelines attached to this report. There is the Main report and in
the Detailband of that is one DesignTime Subreport with a TppImage in
the TitleBand

What I've noticed in the designtime environment in the ReportDesigner
is that if I place objects within the Detailband and press Preview
report I do not see anything. I suspect this is because there are no
pipelines attached but am not sure.

Assuming I'll just use titlebands for my objects and I create a
subreport like this
ASub := TppSubreport.create(Self);
ASub.Band := DetailBand1;//The main report detailband
ASub.PrintBehavior := pbSection;//Each subreport gets own page
ASub.CreateReport(ppReport1);// ppReport1 is the Report Component
ASub.Report.DefaultBands := [btTitle];
ASub.Report.CreateDefaultBands;

ATitleBand := ASub.Report.GetBand(btTitle,0) as TppTitleBand;
AnImage := TppImage.Create(Self);
AnImage.Band := ATitleBand;
AnImage.Picture.LoadFromFile('ATeeChart.bmp');
AnImage.Top := 0.5;
AnImage.Left := 0.5;

ALabel := TppLabel.Create(Self);
ALabel.Band := ATitleBand;
ALabel.Caption := 'Im a label';
ALabel.Top := 0.5;
ALabel.Left := 1.5;



When I Run this application I expect to see 3 pages. The Main report
page, the Design time subreport and my dynamic subreport. What I get
is the first two and my dynamic report preview is a blank.

Advice most welcome.
Dale

Comments

This discussion has been closed.