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

Dynamic Subreport overlays the Mainreport...

edited April 2009 in Subreports
Hello, i have a little Problem..

Delphi7
RB9.01
Language: deutsch
DB: Firebird /ZeosLib

i have a ppReport1 on my mainform ( everything is "default" )..
i load a Template
i create a Subreport
load the template for the subreport
and what happens is: http://www.wavi.at/rbuilder9_01/screen.jpg




Procedure ....
var my_subreport : TppSubReport;
begin:

i load the template via:
ppReport1.CreateDefaultBands;
ppReport1.PrinterSetup.DocumentName:=my_caption;
ppReport1.PDFSettings.Author:='from my Software';
ppReport1.PDFSettings.Author:=gl_st_username;
ppReport1.PDFSettings.Title:=my_caption;

ppReport1.Template.FileName:=(gl_st_reports+'Report_'+inttostr(tag)+'.rtm');
<- i call this the Mainreport
ppReport1.Template.Load;

after this, i change two events:
for schleife_baender := 0 to
versatile_main_handle.ppReport1.BandCount-1 do
begin
if ppReport1.Bands[schleife_baender].ClassName =
'TppDetailBand' then
begin
ppReport1.Bands[schleife_baender].BeforePrint:=
my_BeforePrint;
ppReport1.Bands[schleife_baender].AfterPrint :=
my_AfterPrint;
end;
end;

after this, i load a Subreport:
my_subreport:=TppSubReport.Create(self);
<- i call this the Subreport
my_subreport.Band:=ppreport1.Header;
my_subreport.CreateReport(ppReport1);
my_subreport.Report.CreateDefaultBands;
my_subreport.Report.Template.FileName:= <-
from DB ..
my_subreport.Report.Template.LoadFromFile;



versatile_main_handle.ppReport1.Print;
end;



Where ist the problem - what make i wrong ?

ThanX

Erich

Comments

  • edited April 2009
    As a test, try building the same report via the designer, you will get the
    same result.

    1. A pbChild style subreport prints on the parent report's page space, the
    page Header/Footer are not supported. As an atlerative, use Title/Summary or
    GroupHeader/GroupFooter

    2. If you are going to load a template, there is no need to call
    CreateDefaultBands or configure the PDFSettings. The bands and PDF settings
    are saved as part of the report definition that you are loading.

    3. If you want the subreport to appear at the top of the band, with the
    "Header in MainReport' lable to appear below it, then add a Region to the
    main report header. Place the label inside the Region. Configure the
    Region.ShiftRelativeTo property to reference the subreport.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.