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

How can I print the Copy Number on page?

edited August 2006 in General
How do I print the copy number when I have a report with one page and in the
printer dialog I specify about printing several copies and I want every copy
number to appear printed in every page?
For Example:
Page 1 -> Copy 1
Page 2 -> Copy 2
and so on

Thanks

Comments

  • edited August 2006
    -------------------------------------------------------
    Tech Tip: Printing a Unique Caption for each copy of
    of a multi-copy report sent to the printer.
    -------------------------------------------------------


    Here's example of sending 3 copies to the printer and printing a unique
    caption for each one.


    1. Set Report.PrinterSetup.Collation to True

    2. Set Report.PrinterSetup.Copies to 3


    3. Set the Report.PassSetting to psTwoPass. (add ppTypes to your "uses"
    clause)

    4. Create a private variable in your form: FCopy

    5. In the Report.BeforePrint event code

    FCopy := 0;

    6. In the Report.OnStartPage event code

    if ppReport1.SecondPass and (ppRepor1.AbsolutePageNo = 1) then
    Inc(FCopy);


    7. Add a Label to the Report and in the OnPrint event code something like:

    case FCopy of
    1: ppLabel1.Caption := 'Shipping';
    2: ppLabel1.Caption := 'Order Processing';
    3: ppLabel1.Caption := 'Account Receivable';
    end;



    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2006
    I follow these steps not in the application but in the report that needed it
    using the calc tab. Is that the same? because it didn?t work. Showld I
    check another thing on the configuration?. Programing these steps directly
    on the report file (.rtm) works as in the application?
    Thanks


  • edited August 2006
    I follow these steps not in the application but in the report that needed it
    using the calc tab. Is that the same? because it didn?t work. Showld I
    check another thing on the configuration?. Programing these steps directly
    on the report file (.rtm) works as in the application?
    Thanks

  • edited August 2006
    Hi Ignacio,

    For future reference, please post RAP oriented questions in the RAP
    newsgroup. This helps us understand what the problem is and allows us to
    give you a more accurate answer in less time.

    The tech tip posted is all psuedo code however looking at it, I do not see
    very many items that are not natively available in RAP. My first suggestion
    would be to get this working in Delphi so you can debug any errors or
    mistakes. Then try moving the code to RAP. A couple of notes...

    - When setting the PassSetting in RAP, you will use the boolean properties
    Report.FirstPass and Report.SecondPass.
    - You should declair FCopy in the Declarations | Variables section of the
    code module.
    - Instead of using the Delphi Inc() routine, simply use value := value + 1;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006

    Here is a RAP example that I created. The Report BeforePrint event only
    fires prior to the first time you print or preview in RAP (where as in
    Delphi it will fire once for preview, again for print, etc.). Therefore I
    added a PrintDialogClose event-handler that resets the copy counter to 0.
    Other than that it is the same as in Delphi.

    www.digital-metaphors.com/tips/CopiesCaptionsRAP.zip


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.