No autosearch with print to [pdf] device
Report Builder 9.03, Delphi 6, end user application
Here is code I am using to print a report as PDF ( I have deleted some
unnecessary detail):
rpMainReport.Template.DataBaseSettings.Name :=
'FilingReportA';
rpMainReport.Template.LoadFromDatabase;
DeviceType := dtPDF;
lPDFDevice := TppPDFDevice.Create(nil);
if (FReportOutputStream = nil)
then FReportOutputStream := TMemoryStream.Create
else FReportOutputStream.Clear;
try
lPDFDevice.PDFSettings := rpMainReport.PDFSettings;
lPDFDevice.OutputStream := FReportOutputStream;
lPDFDevice.Publisher := rpMainReport.Publisher;
rpMainReport.ShowAutoSearchDialog:=true;
rpMainReport.PrintToDevices;
finally
lPDFDevice.Free;
end;
The problem is that the AutoSearch dialog does not appear. I see from an old
posting that the Print method (not PrintToDevices) calls
DisplayAutoSearchDialog. But the old posting talked about implementing
OnGetAutoSearchValues. I don't have any code that I want to execute on that
event; I just want the report to show the dialog and get the autosearch
values from the user, and then generate the PDF file. How can I get that
done?
Dennis McFall
Here is code I am using to print a report as PDF ( I have deleted some
unnecessary detail):
rpMainReport.Template.DataBaseSettings.Name :=
'FilingReportA';
rpMainReport.Template.LoadFromDatabase;
DeviceType := dtPDF;
lPDFDevice := TppPDFDevice.Create(nil);
if (FReportOutputStream = nil)
then FReportOutputStream := TMemoryStream.Create
else FReportOutputStream.Clear;
try
lPDFDevice.PDFSettings := rpMainReport.PDFSettings;
lPDFDevice.OutputStream := FReportOutputStream;
lPDFDevice.Publisher := rpMainReport.Publisher;
rpMainReport.ShowAutoSearchDialog:=true;
rpMainReport.PrintToDevices;
finally
lPDFDevice.Free;
end;
The problem is that the AutoSearch dialog does not appear. I see from an old
posting that the Print method (not PrintToDevices) calls
DisplayAutoSearchDialog. But the old posting talked about implementing
OnGetAutoSearchValues. I don't have any code that I want to execute on that
event; I just want the report to show the dialog and get the autosearch
values from the user, and then generate the PDF file. How can I get that
done?
Dennis McFall
This discussion has been closed.
Comments
Try the following:
if myReport.DisplayAutoSearchDialog then
myReport.PrintToDevices;
By design, the PrintToDevices method does not display any dialogs. That is
what the Print method is designed for - it displays dialogs and then
internally call PrintToDevices.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com