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

PrintDialog - Print to File - FileFilter

edited December 2002 in Devices
Hi,

I am trying to do the following: in Print Dialog when Print to File checked
allow the user to select only csv files (or make default extension .csv).
In Report.PrintDialogCreate I have
Report.PrintDialog.FileFilter := 'CSV files|*.CSV';
Report.PrintDialog.DefaultFileExt := '.csv';
But this doesn't work, default extension and filter still .txt.
Could someone help please.

Thanks.
Inna.

Comments

  • edited December 2002
    Thanks for reporting the issue. It has been fixed for the next release. You
    can add these two lines to the print dialog code in ppPDlg.pas and rebuild
    using RBuilder\Source directory instead of RBuilder\Lib to use these
    changes.

    procedure TppPrintDialog.btnPrintToFileClick(Sender: TObject);
    begin

    -->SaveDialog1.DefaultExt := DefaultFileExt;
    -->SaveDialog1.Filter := FileFilter;

    if SaveDialog1.Execute then
    begin
    edtPrintToFileName.Text := SaveDialog1.FileName;

    UpdateFileName;

    UpdateFileSettings;
    end;

    end; {procedure, btnPrintToFileClick}


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited December 2002
    Thanks Jim, it works.

    I have another question though. Can I implement this using RAP? I'd like to
    put this code in OnPrintDialogCreate:
    Report.PrintDialog.FileFilter := 'CSV files|*.CSV';
    Report.PrintDialog.DefaultFileExt := '.csv';
    But I am getting an error: Line 3: Expected: '(' or '[', but found
    'FileFilter' instead.

    Thanks.
    Inna.

  • edited December 2002
    Hi Inna,

    create a pass-through function and pass the report as parameter. The error gets raised because there is RAP RTTI available for this specific property.

    regards,
    Chris Ueberall;
  • edited December 2002
    Sorry,

    I meant there is no RAP RTTI available for this specific property.
This discussion has been closed.