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

Print position.

edited December 2003 in General
Hi all,
there is a property or a method that i can use to know what is the print
position after i have printed a memo in the detail band ?

Thanks in advance.

Massimo.

Comments

  • edited December 2003
    Hi Massimo,

    Inside the memo's OnDrawCommandCreate event you can find out the print
    position of that object in microns if you typecase the aDrawCommand
    parameter as the proper type. Something like the following...

    uses
    ppTypes,
    ppUtils,
    ppDrwCmd,
    ppPrintr;

    procedure TForm1.ppDBMemo1DrawCommandCreate(Sender, aDrawCommand: TObject);
    var
    liMMTop: Integer;
    lTop: Single;
    begin

    liMMTop := TppDrawText(aDrawCommand).Top;
    lTop := ppFromMMThousandths(liMMTop; utInches; pprtVertical; ppPrinter)
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2003
    Thanks Nico for the answer.

    I have tested your procedure but for each rows where the memo is printed in
    the detail band, i have always the same value in the liMMTop variable and i
    think that isn't the position of the last row of the memo.

    Can you give me some other advice to know what is the print
    position after i have printed a memo in the detail band (after the last row
    of the memo) ?

    Thanks.

    Massimo.







    "Nico Cizik (Digital Metaphors)" wrote :
    TObject);
    message
  • edited December 2003
    Hi Massimo,

    Below is a quick example of the code I gave in an earlier post. As you can
    see by the message boxes that are shown, lTop is changing according to where
    it is on the page. Hope this helps.

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

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2003
    I answered this also in your latest post:

    Massimo,

    Try this (works in RB 6.03)...

    add after the 'implementation' keyword:

    uses
    ppTypes,
    ppUtils,
    ppDrwCmd,
    ppPrintr;

    procedure TForm1.ppDetailBand1AfterPrint(Sender: TObject);
    var
    lPosition : Single;
    begin
    lPosition := ppFromMMThousandths(ppReport1.DetailBand.CurrentPosition,
    utInches, pprtVertical, ppPrinter);
    ShowMessage('Detail Band ends at ' + FloatToStr(lPosition));
    end;

    This will show you the position (bottom-most) where the detail band ended in
    Inches. ppReport1.DetailBand.CurrentPosition gives you the position in
    MMThousandths.

    Regards,
    Chuck Van Acker
    Alogent Corp.
  • edited December 2003
    Hi Nico,
    i have tested your example and all works fine.

    I have done the same in the RAP environment but i always have the same value
    in the MMTop variable for each memo.

    There is some problems to use this technique in RAP environment ?

    Thanks.

    My Rap function is this :

    procedure TMemoEndPos.ExecuteFunction(aParams: TraParamList);
    var
    IntReport : tppreport;
    EndPos : Double;
    aDrawCommand : TObject;
    begin

    GetParamValue(0, aDrawCommand);
    GetParamValue(1, IntReport);

    mmTop := TppDrawText(aDrawCommand).Top;

    EndPos := ppFromMMThousandths( mmTop, utPrinterPixels, pprtVertical,
    IntReport.Printer);

    Setparamvalue(2, EndPos);

    end;


    "Nico Cizik (Digital Metaphors)" Wrote
    can
    where
    message
    and
  • edited December 2003
    Hi Massimo,

    I'm sorry, I wasn't aware you were using RAP. I tried something similar to
    what you have below and it worked without problems. Below is a copy of my
    RAP code and passthru Execute function.

    RAP:
    ----------------

    procedure DBMemo1DrawCommandCreate(aDrawCommand: TObject);
    var
    limmPos: Integer;
    ldPos: Double;
    begin

    limmPos := TppDrawText(aDrawCommand).Top;

    ldPos := MemoEndPos(limmPos, Report);

    ShowMessage(FloatToStr(ldPos));

    end;

    PassThru:
    ------------------

    class function TmyMemoEndPos.GetSignature: String;
    begin
    Result := 'function MemoEndPos(aPosition: Integer; aReport: TppReport):
    Double;';
    end;

    procedure TmyMemoEndPos.MemoEndPos(aParams: TraParamList);
    var
    ldEndPos: Double;
    limmTop: Integer;
    lReport: TppReport;
    begin

    GetParamValue(0, limmTop);
    GetParamValue(1, lReport);

    ldEndPos := ppFromMMThousandths(limmTop, utPrinterPixels, pprtVertical,
    lReport.Printer);

    SetParamValue(2, ldEndPos);

    end;

    --
    Best Regards,

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