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

No autosearch with print to [pdf] device

edited October 2005 in Devices
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

Comments

  • edited October 2005

    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
This discussion has been closed.