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

draw a line at runtime

edited June 2004 in General
How to draw a line at runtime?

Comments

  • edited June 2004
    Hello,

    Line Example...

    uses
    ppTypes;

    procedure TForm1.CreateLineAndPrint;
    var
    lLine: TppLine;
    begin

    lLine := TppLine.Create(nil);
    lLine.Band := ppReport1.DetailBand;
    lLine.Style := lsSingle;
    lLine.Position := lpTop;
    lLine.Top := 0.2;
    lLine.Left := 0.2;
    lLine.Width := 3;
    lLine.Height := 0.5;

    ppReport1.Print;

    end;

    ---------------------------------------------
    Tech Tip: Create Reports in Code
    ---------------------------------------------

    A ReportBuilder report is composed of a set
    of components. Like other standard Delphi
    components, the components which make up the
    report layout have a run-time interface.
    That is they can be created and configured
    using Object Pascal code.


    A complete example of creating a report entirely
    in code is contained in the Developers Guide.

    The Developers Guide is located in the
    ..\RBuilder\Developers Guide\ directory.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2004
    Your method is before ppreport1.print, but I want draw a line after
    ppreport1.print, like placed in band.beforeprint, then how to do it?
  • edited June 2004
    Hi,

    If you would like to add objects to a report after Report.Print has been
    called, you will need to manually create the TppDrawCommand objects and add
    them to the report. See the following example on how to add lines below the
    last detail band after the report has begun generating.

    http://www.digital-metaphors.com/tips/FillPageWithLines.zip

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2004
    Why there is error when I write something like
    lDrawLine.position := lpTop;
    The error message is "Undeclared identifier lpTop"
  • edited June 2004
    I spent many time but still can't wirte a line at run-time, my coding is:
    procedure TfmSalesOrder_Print_JewelMax.rpSalesOrderStartPage(
    Sender: TObject);
    var
    lDrawLine: TppDrawLine;
    begin
    inherited;
    lDrawLine := TppDrawLine.Create(nil);
    lDrawLine.Page := rpSalesOrder.Engine.Page;
    lDrawLine.Left := 104000;
    lDrawLine.Top := 30000;
    lDrawLine.Height := 50000;
    lDrawLine.lineposition := lpLEFT;
    //lDrawLine.Width := rpSalesOrder.PrinterSetup.PageDef.mmPrintableWidth;
    end;
    although no compile error, but the line still cannot be shown, what wrong is
    it?
  • edited June 2004
    Hello,

    The following code seemed to work correctly for me. Why are you commenting
    out the Width property? Also, be sure the measurements are correct for your
    page size.

    lDrawLine := TppDrawLine.Create(nil);
    lDrawLine.Page := ppReport1.Engine.Page;
    lDrawLine.LinePosition := lpTop;
    lDrawLine.Left := ppReport1.PrinterSetup.PageDef.mmMarginLeft;
    lDrawLine.Width := ppReport1.PrinterSetup.PageDef.mmPrintableWidth;
    lDrawLine.Top := ppReport1.Engine.PrintPosRect.Top;

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

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