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

Default File Type

edited May 2003 in General
Hello,

I'm using Delphi 5 and RB 6.02:

I added DevExtras and can save to PDF format. Now, what I want to do is
set the default file format from Text to PDF File, after the user gets a
chance to preview the Output on the screen.

I can set the File Name with TppReport.TextFileName but I can't find
where to set the file format.

Thanks.

Skot.

Comments

  • edited May 2003
    Skot,

    You can set the file format you need using the Report.DeviceType property.
    If you are using TExtraDev to print in PDF, I believe you want to set your
    device to 'PDFFile'. Be sure to set the Report.AllowPrintToFile property to
    True.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2003
    Nico Cizik (Digital Metaphors) wrote:

    If I do that then they can't preveiw the report, on screen, it goes to
    the file. :(

    When the printer dialogue comes up, there is a dropdown for FileType as
    well as an edit box for the FileName. I can set Filename OK, but not
    the type, it goes to Text by default and I want it to default to PDFFile.

    Sorry if I'm not too clear.

    Skot.
  • edited May 2003
    Skot,

    Sorry, I didn't understand exactly what you were after the first time. You
    are going to want to add the following lines to the Report.PrintDialogCreate
    event to get the results you need. You can leave the default devicetype
    setting to 'screen' if you do this.

    procedure TForm.ReportPrintDialogCreate(Sender: TObject);
    begin
    Report.PrintDialog.DeviceType := 'PDFFile';
    Report.PrintDialog.PrintToFile := True;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2003
    Nico Cizik (Digital Metaphors) wrote:


    Thanks Nico,

    That's what I was missing: Report.PrintDialog ;)

    Cheers.

    Skot.
This discussion has been closed.