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

ppReport.TextFileName

edited October 2007 in End User
Hi

I want the user to have a default folder to store there reports when saving
to file.
Testing ppReport.TextFileName := 'D:\Temp\test.txt'; works fine with a
normal report (outside the ednduser) but setting the ppReport.TextFileName
in the enduser environment does not work (de folder is not set).

I try do this in the ppReportPrintDialogCreate method just before the
printdialog is shown.

What do i do wrong?

Eric

Comments

  • edited October 2007
    Hi Eric,

    Once a template is loaded, any previously set report properties will be
    replaced by the properties saved with the template definition. Once the
    template is loaded you can successfully set any report properties yourself.
    This can be done using the template event OnLoadEnd. See the article below
    for more information.

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

    The Report.Template object has several events that can be used
    forcustomizing 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 relatedto
    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
    atrun-time.


    1. In the private section of your form declaration you can declare
    anevent-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.