Printerdevices
(Rep = TppReport)
--------Code--------
if FindReportPrinter(ininaam,'Voorbeeld') = 'Ja' then
begin
rep.DeviceType := 'Screen';
end;
if FindReportPrinter(ininaam,'Voorbeeld') = 'Nee' then
begin
rep.DeviceType := 'Printer';
end;
try
if FindReportPrinter(ininaam,'Selectie') = 'Ja' then
begin
rep.ShowPrintDialog := true;
end;
if FindReportPrinter(ininaam,'Selectie') = 'Nee' then
begin
rep.ShowPrintDialog := false;
end;
finally
rep.ResetDevices;
rep.PrinterSetup.DocumentName := Application.Title + ' ' + ininaam;
rep.print;
end;
--------Code--------
When used this code gives me irregular results in my delphi program. One
would assume that if you use this code and the result of the function
FindReportPrinter(ininaam,'Voorbeeld') is 'Ja' (dutch for yes) or
FindReportPrinter(ininaam,'Selectie') is ja that you would get a preview
dialog and
a printersetup dialog. This is true and works ok. If I get Nee and Nee you
should assume that the report would go directly to the printer, without a
preview screend and without a printersetup dialog. Unfortunately that doesnt
work all the time . Some times it does go directly to the printer and some
times it does not, then I first get the dialog that mentions the report is
going to the printer, then i get a preview. Other times i get a preview and
then nothing.
This is very irritating offcorse . I tried putting a resetdevices before
the print but doesn't suffice and does not solve the problem. What could I
do that i just
let the report do what I tell it to! (listen to the master! @#$%# )
Help!
--------Code--------
if FindReportPrinter(ininaam,'Voorbeeld') = 'Ja' then
begin
rep.DeviceType := 'Screen';
end;
if FindReportPrinter(ininaam,'Voorbeeld') = 'Nee' then
begin
rep.DeviceType := 'Printer';
end;
try
if FindReportPrinter(ininaam,'Selectie') = 'Ja' then
begin
rep.ShowPrintDialog := true;
end;
if FindReportPrinter(ininaam,'Selectie') = 'Nee' then
begin
rep.ShowPrintDialog := false;
end;
finally
rep.ResetDevices;
rep.PrinterSetup.DocumentName := Application.Title + ' ' + ininaam;
rep.print;
end;
--------Code--------
When used this code gives me irregular results in my delphi program. One
would assume that if you use this code and the result of the function
FindReportPrinter(ininaam,'Voorbeeld') is 'Ja' (dutch for yes) or
FindReportPrinter(ininaam,'Selectie') is ja that you would get a preview
dialog and
a printersetup dialog. This is true and works ok. If I get Nee and Nee you
should assume that the report would go directly to the printer, without a
preview screend and without a printersetup dialog. Unfortunately that doesnt
work all the time . Some times it does go directly to the printer and some
times it does not, then I first get the dialog that mentions the report is
going to the printer, then i get a preview. Other times i get a preview and
then nothing.
This is very irritating offcorse . I tried putting a resetdevices before
the print but doesn't suffice and does not solve the problem. What could I
do that i just
let the report do what I tell it to! (listen to the master! @#$%# )
Help!
This discussion has been closed.
Comments
message, is called upon in the 'beforeprint' event. But now i found out that
if i change a setting so 'ja' will be 'nee', the first time i try to print
it uses the old parameters and the second time i print it will use the new
parameters. So i presume the event where the code is called, is wrong. What
event should i try to execute this code then? I'm puzzeled!
regards,
Thomas
report object before pages begin generating. However, you might not want to
call Report.Print inside this event, since you're already inside of a call
to Report.Print. You shouldn't need to call Report.ResetDevices either.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
not letting the printdialog and the preview display show the first time. I
even tried with closing the program and restarting it. That didn't give the
desired result eather.
is always causing the if statements to evaluate to false? Then since you
have no 'else' to catch a problem, the Report.DeviceType may not be getting
set correctly. I can't reproduce the problem, it is always working correctly
here. Can you send a working example to support@digital-metaphors.com which
shows this problem.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com