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

Setting TextFileName in RAP

edited October 2002 in RAP
I want to force the output of a report to a text file, in RAP.

Have done the following in both ReportOnPrintDialogCreate and OnCreate ...

Report.AllowPrintToFile := True;
Report.TextFileName := 'A:\txtfile' + FormatDateTime('yymmdd',
CurrentDate);

the PrintDialog box appears with the ability to output to file butit doesn't
seem to change the default filename (stored in the template) shown in the
Print Dialog box.

What am I doing wrong? Am I using the wrong event?

I'd also like to know how to force the output to a text file without even
displaying the PrintDialog box - if possible?

Thanks in advance!

Regards,

Pete Colson

Comments

  • edited October 2002
    Assign the Report.Template.OnLoadEnd event to set these properties or set
    these properties before you call Report.Print. RAP events won't work
    because RAP events fire after the Report.Print method has been called and
    the report has already been initialized to print for the configuration
    assign before the Print call.

    You can force the report to print to the file device by setting the
    Report.Devicetype to text file and then set the
    Report.ShowPrintDialogProperty to false. Please look through the
    Developer'sGuide and help file for information on configuring ReportBuilder
    reports.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    It's a completely stand-alone template that I want users to load in Report
    Explorer, so I can't control it at the OnLoadEnd event...

    Have looked at all the documentation I could find to get this far - but
    didn't realise that I can't do this in RAP as I can get at all the
    properties without problem (in effect I didn't realise they are ReadOnly)...

    Thanks for the suggestion on how to force the report to print to the file
    device - I tried it in RAP but it didn't work (presumably because it's too
    late) - hence asking you!!

    Is there no way in RAP of getting around this?

    Regards,

    Pete



  • edited October 2002
    You can use the OnLoadEnd event. On your form, there is a report object
    with a single template object embedded in it. The template object is used by
    the report designer to load and save templates. You can assign an event
    handler to this object to perform operations on the report after the user
    load a template. See the main Report Explorer end user demo. The reason it
    does this is to assign the OnPreviewFormCreate event on the newly loaded
    report by using this OnLoadEnd event of the template. You can use the same
    approach to configure the report properties.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.