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

Print different strings on each copy

edited January 2015 in General
Hello,

I am using ReportBuilder to print an invoice. This invoice is printed on 3
copies.
On each copy I need to print a different string.
I need a hint to achieve this.
Thanks

Comments

  • edited January 2015
    Hi Ben,

    If you need to display the copy number, you can use the
    TppSystemVariable with VarType property set to vtCopyNo or vtCopyNoDesc.

    If you would like more control over what is displayed, you can use the
    technique described in the following article.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Formatting/How_To...Unique_Caption_for_Each_Copy

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2015
    Hi Nico,
    Thanks,
    That is just what I am looking for.
    Best regards
    Ben


    "Nico Cizik (Digital Metaphors)" a ?crit dans le message de groupe de
    discussion : 54cc0800$1@mail....

    Hi Ben,

    If you need to display the copy number, you can use the
    TppSystemVariable with VarType property set to vtCopyNo or vtCopyNoDesc.

    If you would like more control over what is displayed, you can use the
    technique described in the following article.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Formatting/How_To...Unique_Caption_for_Each_Copy

  • edited February 2015
    Hi Nico,

    I tried your solution, without success. It is always printing the same
    string, (The last one).
    I am pasting here the code I inserted in the unit.
    ====================

    unit printP2;

    interface

    type
    TPrintP2fmp = class(TForm)
    ppReport1: TppReport;
    ppTbl: TppDBPipeline;
    ppParameterList1: TppParameterList;
    ppDetailBand1: TppDetailBand;
    ppRegionC: TppRegion;
    ppSubReport3: TppSubReport;
    ppChildReport7: TppChildReport;
    ppDetailBand7: TppDetailBand;
    ppShape3: TppShape;
    ppCopy1: TppLabel;
    procedure FormCreate(Sender: TObject);
    procedure ppReport1BeforePrint(Sender: TObject);
    procedure ppReport1StartPage(Sender: TObject);
    procedure ppPageStyle1BeforePrint(Sender: TObject);
    private
    FCopy : Integer;
    public
    end;

    implementation


    {$R *.DFM}

    Const
    StrMsgCopy : Array[0..2] of String = ( 'CLIENT COPY',
    'ACCOUNTING COPY',
    'STORE COPY'
    );

    procedure TPrintP2fmp.ppReport1BeforePrint(Sender: TObject);
    begin
    FCopy := 0;
    end;


    procedure TPrintP2fmp.ppPageStyle1BeforePrint(Sender: TObject);
    begin
    if Assigned(ppCopy1) then
    ppCopy1.Caption := StrMsgCopy[Fcopy Mod 3];;

    end;

    procedure TPrintP2fmp.ppReport1StartPage(Sender: TObject);
    begin
    if ppReport1.SecondPass and (ppReport1.AbsolutePageNo = 1) then
    inc(Fcopy);
    end;

    end.
  • edited February 2015
    Hi Ben,

    Did you try running the example? Does it function correctly?

    Try tracing into the BeforePrint and StartPage events and see if all the
    code is properly executing and that the values are correct.

    Best Regards,

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