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

OnPreviewFormCreate

edited January 2008 in General
Hi!

An error raises when I try to make Print to my report:
ppReport1.OnPreviewFormCreate : Invalid Property value. And the rtm file
desn not have this event, and not does the ppReport1 object. So what is
the problem?

Thanks!
Jordi



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited January 2008
    ----------------------------------------------
    Tech Tip: Working with Report Templates
    ----------------------------------------------

    Whenever you save a template to an .rtm file, all of the published
    properties of the Report are saved. This includes all Properties
    and Events that are visible in the Object Inspector. For the events,
    the 'name' of the event-handler procedure is saved.

    When you load an .rtm all of the properties values of the TppReport
    component are set to the values that were stored to the .rtm.

    If you load an .rtm that had OnStartPage assigned then it will
    be re-attached - provided that the event-handler method is a published
    procedure of the report's owner. The Owner is normally the form.


    On the other hand, if you load an .rtm that did NOT have OnStartPage
    assigned
    when it was saved, you will need to programmatically assign the
    event-handler.

    Example:

    You have a form with an event-handler for OnStartPage...

    type
    Form1 = class(TForm)
    procedure Form1StartPageEvent(Sender: TObject);

    end;


    You need to attach the event-handler after loading......

    myReport.Template.LoadFromFile;
    myReport.OnStartPage := Form1StartPageEvent;



    --
    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
This discussion has been closed.