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

Lines and shapes across sections

edited October 2001 in General

How can I force vertical lines and boxes to span sections, say from header
to footer, not in code but just in the designer. Its a doddle in Crystal
Reports but I can't see how?

Paul

Comments

  • edited November 2001
    Use the PageStyle band. It will print behind all other bands in the report.
    You'll need to resize the band's height to be the height of the page.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    ok, but is not a very elegant solution. What if you want a box to flow from
    a group header to a group footer?


  • edited November 2001
    You'll have to use TppLines in the detailband to connect the group header to
    the group footer.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    Hmm...I see. Still a bit of a cludge. Am I right in thinking that, if I were
    clever enough, the architecture is there for me to write a more
    "intelligent" ( no offense intended) line component; or is the Designer
    itself imposing this limitation?


    Thanks, Paul


  • edited November 2001
    RB is a banded style report writer. A component can only be parented by one
    band and it generates a draw command when it has finished generating in its
    band. You need to create a draw line command which has a length to extend
    over multiple bands.

    You may be able to do this with your own custom line descendent. Create a
    vertical line component and register it with RB, so that your users can use
    it in the designer. Add a property to it, like StretchToBottom?, and in the
    PropertiesToDrawCommand method, it should create a draw line command that
    which has a length from its top position to the bottom of the page. There
    is an example of creating a custom component in your installation under
    ..\RBuilder\Demos\RCL\Checkbox.

    The part thay may be hard, is adding the StretchToGroupFooterBottom
    property. This will require a mechanism that runs the report in two passes
    (Report.PassSetting). The first pass will generate a list of group footer
    bottom positions. As the report generates in the second pass, the line draw
    command will have to be generated based on the group footer positions in the
    list. This is probably the best alternative if you want to drop one line
    component in a band and have it generate to a position on the page
    respective to another band?


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    Thanks...that makes some sense...I'll give it a try when I get time and if I
    succeed I'll post up the solution


  • edited November 2001
    In article <8EAE82296ACCD311A039005004E0CAC0057A60@DMSERVER>, Paul Toms wrote:

    I did it this way and it works well. Every Line which has ParentHeight,
    ReprintonOverflow and Position Left or right will be painted to the footer or
    to the summary-band.
    ---
    Procedure TGFDrucken.GFPrintStartPage(Sender: TObject);
    begin
    { Für das Linienmachen wichtig }
    FCurrentPosition := -1;
    end;

    procedure TGFDrucken.GFPrintEndPage(Sender: TObject);
    var
    I: Integer;
    liBottom: Integer;
    liTop: Integer;
    NewLine: TppDrawLine;
    xLine: TppLine;
    begin
    if FCurrentPosition = -1 then exit;
    if not MakeLines then exit;
    liTop := FCurrentPosition;
    liBottom := GFPrint.Engine.PageBottom;
    if GfPrint.AbsolutePageCount = GfPrint.AbsolutePageNo then begin
    if not GfPrint.FooterBand.PrintOnLastPage then liBottom :=
    GfPrint.SummaryBand.CurrentPosition;
    end;

    { TppDrawLine wird automatisch zerstört, braucht man sich nicht drum
    kümmern! }
    for I := 0 to GFPrint.DetailBand.ObjectCount-1 do begin // Iterate
    if GFPrint.DetailBand.Objects[i] is TppLine then begin
    xLine := TppLine(GFPrint.DetailBand.Objects[i]);
    if (xLine.ParentHeight) and (xLine.ReprintOnOverFlow) and
    (xLine.Position in [lpLeft, lpRight]) then begin
    NewLine := TppDrawLine.Create(Nil);
    NewLine.Page := GfPrint.Engine.Page;
    NewLine.LinePosition := xLine.Position;
    NewLine.Left := xLine.mmLeft +
    Gfprint.PrinterSetup.PageDef.mmMarginLeft;
    NewLine.Top := liTop;
    NewLine.Height := liBottom - liTop;
    NewLine.Width := xLine.mmWidth;
    NewLine.LineStyle := xLine.Style;
    NewLine.Pen.Assign(xLine.Pen);
    end;
    end;
    end; // for
    FCurrentPosition := -1;
    end;

    procedure TGFDrucken.ppDetailBand1AfterPrint(Sender: TObject);
    begin
    { Hier muß die Position gemerkt werden }
    FCurrentPosition := GFPrint.Engine.PrintPosRect.Top;
    end;
    ---
    HTH

    Gruß aus den Bergen
    Günter
This discussion has been closed.