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

how to know if a .rtm template has columns

edited January 2005 in General
Hi!

I'm using RBuilder Pro 7 and Delphi 7.
I save template reports as .RTM files, so customers can "choose and
print" easily.

If the report prints labels, I want to show a message before printing
it, son...
How can I know if the loaded report has columns (labels report)?

Thanks!

Comments

  • edited January 2005
    The TppReport has an integer property Columns, which holds the number of
    columns in the report. Just test if Columns > 1

    David Caouette
    Omniciel International inc.

    "Santy Concepci?n" a ?crit dans le message de
  • edited January 2005
    Hi Santy,

    David is correct. To add to his advise, you may want to use the built-in
    template event OnLoadEnd to check this value. See the article below on
    enabling and using this event.

    ----------------------------------------------
    Tech Tip: Using Template Events
    ----------------------------------------------

    The Report.Template object has several events that can be used for
    customizing what happens when a report is loaded or saved:

    - OnLoadStart
    - OnLoadEnd
    - OnNew
    - OnSaveStart
    - OnSaveEnd


    The OnLoadEnd and OnNew events are often used to perform actions related
    to report and data initialization.

    The OnSaveEnd event is often used to save additional descriptive
    ("meta") data to the database each time the report is saved.

    Example:

    The Report.Template events are public and therefore must be assigned at
    run-time.


    1. In the private section of your form declaration you can declare an
    event-handler method:

    TForm = class(TForm)
    private
    procedure myTemplateOnLoadEndEvent(Sender: TObject);

    public

    end;


    2. In the Form.OnCreate event, you can assign the event-handler to the
    event:

    procedure TForm1.FormCreate(Sender: TObject);
    begin

    ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;

    end;


    3. Implement the event-handler method:

    procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
    begin

    {add code here to initial the report or data, etc. }
    ppReport1.PrinterSetup.MarginTop := 0.5;

    end;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.