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

Using TppDevice

edited December 2005 in Devices
Hi,

I need to do some processing in the report data before this data is printed.
Each record in the data to be printed must be assigned a continuous page
number, for archival purposes. This archive is composed of "books" where
each book has 300 pages.
The report detail band has one TppRichText component in it, with stretch =
TRUE, so it can print in more than one page if needed. Due to this fact, I
must do a "pre-print" process and check where did the TppRichText ended (I
use the event DetailBand.OnAfterGenerate, please let me know if this is
correct). During this "pre-print" process, I control and store in the
dataset fields the "book" and the page in the "book" where the band was
printed (ended printing), using Report.PageNo as a base for the calculation.
In this report there is also a group, that breaks whenever the "book"
changes. This group will start a new page and will reset the pagination of
the report. This group is disabled during "pre-print" because there is no
"book" value assigned to the break field.

I hope this works out ok, if you see something that is incorrect please let
me know.

In order to do the "pre-print" process, I will use a TppDevice class, that I
will instantiate and the will use the Report.PrintToDevices method.

What I need to know is if the TppDevice class (ancestor of all the devices
class, I supose) will use the paper settings that I have assigned in the
Report.PrinterSetup, including margins.

Best regards,

Nuno Fonseca

Comments

  • edited December 2005
    I am now using a TppStreamDevice and assigning the OutputStream property to
    a TMemoryStream (that has been created), but it is giving me an "Abstract
    Error".
    If I preview/print the Report all works well.

    Can someone help me ?

    Regards,

  • edited December 2005
    Hi Nuno,

    Sorry for the delay...


    This is correct. Simply create a TppDevice object and connect its publisher
    to the report's.


    Yes, the entire PrinterSetup should be available.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2005
    Hi, Nico

    Thank you for your reply. TppDevice does work, and TppStreamDevice works,
    but terminates with an "Abstract error". As I prefer to use the TppDevice,
    all seems ok.

    Now I need to be able to send only a set of pages to the printer. Usually
    when we want to print the report, we do

    report.ShowPrintDialog := False;
    report.DeviceType = 'Printer';
    report.Print;

    This code prints all the pages in the report and doesn't show the print
    dialog. We want to be able to print only some pages (ex: pages 3 to 6)
    without showing the print dialog.
    I know there is a TppReport method called "PrintPageList", how does it work
    (no help for it in D2005).

    Regards,



  • edited December 2005

    Please run RBuilder\Demos\Reports\Demo.dpr and check out the Printer
    section. There is an example there.





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2005
    Hi Nard,
    Thanks, I've found it.
    For anyone who is interested in this demo, it's in Delphi unit dm0124.pas,
    in the folder RBuilder\Demos\Reports\

    Regards,


This discussion has been closed.