PrintDialogCreate and settings!
Hi, I have a problem with print settings...
On an anchestor form, i have code like this:
procedure XXXXXX.reportPrintDialogCreate(Sender: TObject);
Begin
if CONDITION then begin
(Sender as TppReport).PrinterSetup.Copies := 1 ;
(Sender as TppReport).AllowPrintToFile := True;
(Sender as TppReport).PrintDialog.PrintToFile := True;
(Sender as TppReport).PrintDialog.DeviceType := dtPDF ;
(Sender as TppReport).PrintDialog.TextFileName :=
IncludeTrailingBackSlash( ......... FILENAME ETC )
end;
end;
shortly, if a condition is true, I'll automatically set the report to print
to defined PDF file.
but Sometimes, the user can deselect the "Print to file" check, and decide
send report to a printer.
here we have the problem: even if i uncheck the print to file oprtion, the
report will generate the given file name.... if I clear the filename field
and uncheck the options, the report will generate an error "file name not
exists"...
it seems that ignore some end-user options....
nb: RB 11.02 on Delphi 7.
thanks
On an anchestor form, i have code like this:
procedure XXXXXX.reportPrintDialogCreate(Sender: TObject);
Begin
if CONDITION then begin
(Sender as TppReport).PrinterSetup.Copies := 1 ;
(Sender as TppReport).AllowPrintToFile := True;
(Sender as TppReport).PrintDialog.PrintToFile := True;
(Sender as TppReport).PrintDialog.DeviceType := dtPDF ;
(Sender as TppReport).PrintDialog.TextFileName :=
IncludeTrailingBackSlash( ......... FILENAME ETC )
end;
end;
shortly, if a condition is true, I'll automatically set the report to print
to defined PDF file.
but Sometimes, the user can deselect the "Print to file" check, and decide
send report to a printer.
here we have the problem: even if i uncheck the print to file oprtion, the
report will generate the given file name.... if I clear the filename field
and uncheck the options, the report will generate an error "file name not
exists"...
it seems that ignore some end-user options....
nb: RB 11.02 on Delphi 7.
thanks
This discussion has been closed.
Comments
For future reference, please use your real name when posting to these
newsgroups.
This is most likely a timing issue. Instead of assigning the properties of
the actual print dialog, try assigning the report properties before making a
call to Report.Print.
Report.PrinterSetup.Copies := 1;
Report.AllowPrintToFile := True;
Report.ShowPrintDialog := True;
Report.DeviceType := 'PDF';
Report.TextFileName := FileName;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'm sorry but a have to do it in an anchestor form.... it's a application
global settings....
and i need to see the preview before decide to create pdf file or print
report. so i can't set this proerties before print method
Once again, please use your real name when posting to these newsgroups.
I now see the limitation you have. Upon further research, you need to
remove the following line from your code below.
(Sender as TppReport).PrintDialog.PrintToFile := True;
This should fix the issue.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
but i have leave the line, the print dialog don't propose me to save to pdf
file.
In my quick testing with RB 11.03, setting the following properties
automatically checked the Print To File option and allowed me to print to a
printer if it was unchecked.
procedure TForm1.ppReport1PrintDialogCreate(Sender: TObject);
begin
ppReport1.PrintDialog.AllowPrintToFile := True;
ppReport1.PrintDialog.DeviceType := 'PDF';
ppReport1.PrintDialog.TextFileName := 'c:\MyReport.pdf';
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'll upgrade as soon as possible and try.
thanks.