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

AllowPrintToFile

edited March 2009 in End User
Hi!

Delphi 2009. RB 11.03.

I have trouble when i attempt to write a report to a pdf. I have set report
properties as follows

report.devicetype = 'PDF'
report.allowprinttofile = true
report.showsearchautosearchdialog = false
report.showprintdialog = false

report.AutoSearchFields[0].SearchExpression := '20090331';
report.AutoSearchFields[1].SearchExpression := 201095;


I know that this report gives a resultset.

When i set
report.showsearchautosearchdialog = true
report.showprintdialog = true

and then run the report .
I get autosearchdialog and press 'OK'.
I get printdialog and the filetype is correct and filename is correct.
I select 'OK' here and the file is printed.

Why doesn't this happen without showing the dialogs?
Have i missed something on this RB 11.03?

Best regards,
Terje

Comments

  • edited March 2009
    Hi Terje,

    Which event are you setting these properties? Are you calling Report.Print
    or PrintToDevices?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2009
    HI Nico,

    It is done from a buttonclick event within a delphi-form in a while .. next
    loop in a dataset.
    Se source below...

    procedure TfrmOwnercalc.btnPDFToOwnerClick(Sender: TObject);
    var
    TmpFile: String;
    begin
    rptEieravregning.AllowPrintToFile := true;
    rptEieravregning.DeviceType := 'pdf';
    rptEieravregning.ShowAutoSearchDialog := false;
    rptEieravregning.ShowPrintDialog := false;
    while not dbEiere.Eof do
    begin
    TmpFile := dbEiere.FieldByName('Nummer').AsString;
    TmpFile := AppsPath+'BDEA'+TmpFile+'.pdf';
    rptEieravregning.TextFileName := TmpFile;
    rptEieravregning.AutoSearchFields[0].SearchExpression := '20090331';
    rptEieravregning.AutoSearchFields[1].SearchExpression :=
    dbEiereNummer.AsString;
    rptEieravregning.Print;
    dbEiere.Next;
    end;
    end;

    This worked in D6 and RB7 using Extradevices. Am i missing something new i
    RB?


    Regards, Terje




This discussion has been closed.