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

Newbie question - how to print every record in a separate page?

edited June 2002 in General
Hi:

I have to build a very simple report. It is powered by a TDataSet
descendent. I have add a DataSource and a DBPipeLine to the unit.
Everything seems to be working except that I want to print every record in a
separate page.

I have spent over half an hour checking the properties and methods of the
eport and the band component but still couldn't figure how to do it.

TIA,
Ping Kam

Comments

  • edited June 2002
    Create a group around the detail band, based on the detail band key value.
    Set the group to start on a new page from the Groups dialog. Press Ctrl-G
    to show the dialog.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited June 2002
    "Jim Bennett (Digital Metaphors)" wrote in
  • edited June 2002
    yes

  • edited June 2002
    You can create the group value as a calculated field on the dataset and use
    the dataset's OnCalcFields event to change the value. You can also code the
    OnGetBreakValue in code to cause a group to break:

    ---------------------------------------------
    Article: Forcing a Page Break
    ---------------------------------------------

    Question:

    How can I force a page break occur based upon
    a condition calculated at run-time.

    2 of the best solutions follow:

    Solution 1:

    Define a Group that starts on a new page when
    it breaks. Then use the Group.OnGetBreakValue
    event to control the timing of the break.

    1. From the Report Designer, select Report | Groups
    to access the Group dialog.

    2. Define a group based upon a static component,
    such as a Label or Variable. Click the
    Start new page checkbox. Close the dialog.

    3. Using the object inspector's drop down list,
    find and select the TppGroup object.

    4. Create an event-handler for the Group's
    OnGetBreakValue event.

    5. Add code to set the break value.


    procedure Form1.Group1OnGetBreakValue(Sender: TObject; var aBreakValue:
    String);
    begin

    if condition then
    aBreakValue := 'Some Value';

    end;


    Solution 2:

    1. Place a subreport at the point where you might want a page break.

    2. Remove its summary band and reduce the height of its detail and
    title bands to zero.

    By programmatically setting the title band's NewPage property you can
    conditionally force a page break. Note that everything after the
    subreport that is in the same band with it will need to
    ShiftRelativeTo the subreport.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited June 2002
    I will give it a try.

    Thanks,
    Ping Kam

This discussion has been closed.