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

main report with 4 child subreports question

edited February 2006 in General
i'm getting a blank page after subreport1 and before subreport2.

i have a main report with 4 subreports (printbehavior pbChild).
subreport1 could possibly overflow to 2 pages based on the contents of a
tppRichText control on subreport1. the remaining 3 subreports are each
a single page and should start/end on their own page. there is a piece
of information that needs to appear on the bottom of each page generated
by subreport1. i'm attempting to do this with a footer on the
mainreport and setting a flag if i'm printing subreport1 then make the
footer visible; else make it invisible. (i'm still trying to find the
best way to set this flag so the footer prints correctly. i was using
the subreport's on print (or the subreports childreport onstartpage, or
the subreports detail band before print) but subreport2 events are being
called before the footer is printed for page 2 of subreport1.)

so for each record i want subreport1 (either 1 page or 2) to print; new
page for subreport2; new page for subreport3; new page for subreport4.
i'm ok if subreport1 is only a single page. however when it needs to
print a second page, after it prints the 2nd page of subreport1, i'm
getting a blank page before subreport2 page. i'm not sure why this is
happening, but if i eliminate the footer i don't have a problem.

so my question is how can i approach this? i need to print a piece of
data at the bottom of each page subreport1 generates; and i want the
subsequent subreports to print on there own page.

i've tried changing all the subreports to section, assigning the
datapipeline to the main report only but then i get blank page at the
beginning and end.

any suggestions?
thanks!!
-martha

Comments

  • edited February 2006
    Hi Martha,

    One option you may not have explored is manually adding the footer
    information as individual draw commands at the end of each page. You could
    ensure there is space below each subreport using the StopPosition property
    and when the footer data is needed, simply add the appropriate draw commands
    to the page in the proper position.

    Adding draw commands to a page is fairly straight forward except all
    measurements are done in microns and are made on the page as a whole, no
    bands. Below is an example of creating a draw command and adding it to a
    page. Take a look inside the ppDrwCmd.pas file for the different types of
    draw commands and their properties.

    procedure TForm1.ppGroupFooterBand1AfterPrint(Sender: TObject);
    var
    lDrawShape: TppDrawShape;
    liTop: Integer;
    liPageStart: Integer;
    begin
    liPageStart := ppReport1.PrinterSetup.PageDef.mmMarginTop +
    ppReport1.Header.mmHeight;

    if (ppReport1.Engine.PrintPosRect.Top <> liPageStart) then
    begin
    lDrawShape := TppDrawShape.Create(nil);

    lDrawShape.Page := ppReport1.Engine.Page;

    liTop := ppReport1.GroupFooter[0].PrintPosRect.Bottom;

    lDrawShape.Left := ppReport1.PrinterSetup.PageDef.mmMarginLeft;
    lDrawShape.Top := liTop;
    lDrawShape.Width := ppReport1.PrinterSetup.PageDef.mmPrintableWidth;
    lDrawShape.Height := ppReport1.Engine.PageBottom - liTop;
    lDrawShape.Brush.Style := bsFDiagonal;
    lDrawShape.Pen.Color := clBlack;
    lDrawShape.Brush.Color := clBlack;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.