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

Printing the Name or Path of the report's rtm file

edited February 2004 in General
How do I print the actual filename of the rtm file at the bottom of my
report? I tried using DocumentName but it just prints the name of the
reportbuilder's report component name.

To make things muddier, I have a dynamic report where they can print up to
10 reports at once by loading them into subreports, so simply writing a
pipeline where I dump them is difficult as well. Hoping there is is a
system field like documentName available but prints the physical rtm
filename.

Thanks,

Karen McKenzie

Comments

  • edited February 2004
    Hi Karen,

    You can use the template event OnLoadEnd to access the
    Report.Template.FileName and remove the file path if you would like. Check
    out the article below on using the template events.

    ----------------------------------------------
    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;


    --
    Best Regards,

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