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

Control pagebreak with the detail band

edited December 2001 in General
I'd like to add something like "amount carried forward" at the end of a
page, when the details are continued on the next page. How would I set that
up best I can't figure out how to control the pagebreak withn the
detailband.

Thank you for any help

Klaus Westphalen

Comments

  • edited December 2001
    Have a look at the RBAddOn component set. It includes a PageBreak component
    that would be handy for you. www.bancoems.com/RBAddon.htm


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    I should have noted, I need something for the End User ..

    thanks
  • edited December 2001

  • edited December 2001
    See, problem is the language set up - I wouldn't want to mix German and
    English - isn't there another workaround with the standard tools ??


  • edited December 2001
    The only way to add a 'carried forward' message, when the band prints on the
    next page, is to use draw commands. Since, the detail band may be dynamic
    height, you should be able to use the DetailBand.AfterPrint event to check
    if DetailBand.Overflow. If it does overflow, then this means that it
    couldn't fit on the current page and will print on the next page. Set a
    boolean flag if this is true. Then use the Report.OnEndPage event to create
    a DrawText command in the location where you want the 'Carried Forward' to
    be displayed. To create a DrawText on the page:

    uses
    ppTypes, ppUtils;

    ...
    procedure TForm1.DrawText(aText: String);
    var
    liHeight: Integer;
    lDrawText: TppDrawText;
    liTop: Integer;
    liWidth: Integer;
    lBitmap: TBitmap;
    begin

    lBitmap := TBitmap.Create;

    {half inch from bottom of page}
    liTop := ppReport1.PrinterSetup.PageDef.mmPrintableHeight - 12700;

    lDrawText := TppDrawText.Create(nil);
    lDrawText.Page := ppReport1.Engine.Page;
    lDrawText.Text := aText;
    lDrawText.Font.Size := 10;
    lDrawText.Font.Name := 'Arial';
    lDrawText.Font.Color := clRed;
    lDrawText.Color := clAqua;
    lDrawText.Left := ppReport1.PrinterSetup.PageDef.mmMarginLeft +
    (ppReport1.PrinterSetup.PageDef.mmPrintableWidth div 2);

    lBitmap.Canvas.Font := lDrawText.Font;

    liHeight := lBitmap.Canvas.TextHeight(lDrawText.Text);
    liHeight := ppToMMThousandths(liHeight, utScreenPixels, pprtVertical,
    ppReport1.Printer);

    lDrawText.Height := liHeight;

    lDrawText.Top := liTop - liHeight;

    liWidth := lBitmap.Canvas.TextWidth(lDrawText.Text);
    liWidth := ppToMMThousandths(liWidth, utScreenPixels, pprtHorizontal,
    ppReport1.Printer);

    lDrawText.Width := liWidth;

    lBitmap.Free;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    Hi Klaus,


    what is the difference between a German and an English pagebreak?
    Furthermore, isn't mixing German with English the standard in German
    speaking today ('Neudeutsch' or 'Denglisch')?


    regards,
    Chris Ueberall;

This discussion has been closed.