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

SinglePageOnly

edited January 2012 in General
Hello

Delphi XE, Windows 7 64 bit and RBuilder 14.2.

I have a report that worked just fine until the most recent RBuilder
upgrade. The report is attached to a kbmMemTable that contains only one
record and as a result, the report generates only one page of output. The
report would hang when I pressed the print button. It would also hang if
the side by side page view icon on the preview was depressed. After a
significant amount of investigation setting the SinglePageOnly := True
resolved the issue.

This raises the question of how to handle a situation where the total page
number has a range from 1 to > 1? Also, is there a relationship of this
finding with that of Chau Chee Yang's finding on the 20th?

TIA

John

Comments

  • edited January 2012
    The new scrollable page preview uses a background thread to generate pages
    and this can cause issues in some scenarios.

    1. One solution is to use the old single page preview by setting
    Report.PreviewFormSettings.SinglePageOnly to True. If you are loading
    reports from .rtm files or a database, use the Report.Template.OnLoadEnd
    event to set this property after the template loads.

    2. If you have datasets that are shared between VCL controls and the report,
    try setting DataSet DisableControls/EnableControls as shown below. Even if
    this does not completely solve the problem, it is recommend for performance,
    because when the report iterates over the dataset, the dataset fires lots of
    events that notify the visual controls to update themselves. (see the Delphi
    help topic for DataSet
    DisableControls)

    myDataSet.DisableControls;

    try
    myReport.Print;
    finally
    myDataSet.EnableControls;
    end;


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2012
    Nard:

    The tables are shared between VCL components and the report.

    Both of the solutions mentioned below worked. Which one is applicable would
    obviously depend on the situation.

    John

This discussion has been closed.