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

Controlling end user print dialog

edited February 2003 in End User
Hello All

Delphi 5, RB 6.03, ExtraDevices

We are trying to configure the print dialog in an end user reporting
solution. We would like to be able to check the 'Print to file' option and
set the file type to Excel for reports that are only intended for output to
Excel.

I have tried using the OnPrintDialogCreate and the GlobalOnCreate events but
the dialog still defaults to the standard print options when displayed.

Is this possible ?

Regards, Paul Hughes.

Comments

  • edited February 2003
    I modified the RBuilder\Demos\EndUser\ReportExplorer example to do this as
    shown below.....


    {---------------------------------------------------------------------------
    ---}
    { TmyEndUserSolution.LoadEndEvent }

    procedure TmyEndUserSolution.LoadEndEvent(Sender: TObject);
    begin
    ppReport1.OnPreviewFormCreate := PreviewFormCreateEvent;
    ppReport1.OnPrintDialogCreate := PrintDialogCreateEvent;
    end; {procedure, LoadEndEvent}


    {---------------------------------------------------------------------------
    ---}
    { TmyEndUserSolution.PrintDialogCreateEvent }

    procedure TmyEndUserSolution.PrintDialogCreateEvent(Sender: TObject);
    begin

    ppReport1.PrintDialog.AllowPrintToFile := True;

    ppReport1.PrintDialog.TextFileName := 'c:\myReport.txt';
    ppReport1.PrintDialog.DeviceType := dtReportTextFile;

    end;


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2003
    Thanks Nard

    What I was after was a way of doing this from RAP so that within a report
    designed for output to Excel ( using ExtraDevices ), I can set up the print
    dialog to expect output to a file rather than the printer.

    Cheers, Paul.
This discussion has been closed.