PrintToDevices and OnGetAutoSearchValues
Hello,
I'm using PrintToDevices to generate report to an archive.
PrintToDevices doesn't call the OnGetAutoSearchValues event.
It only works, when I call DisplayAutoSearchDialog before PrintToDevices.
You'll find my code at the end of this message.
Any ideas?
Thank you!
Lars Hirthe
CODE:
--------
...
var
BlobStream : TStream;
ArchiveDevice : TppArchiveDevice;
begin
...
ppReport.DeviceType:=dtArchive;
ArchiveDevice:=TppArchiveDevice.Create(nil);
with qryReportArchive do
try
ppReport.OnGetAutoSearchValues:=GetAutoSearchValuesFromParams;
Params[0].AsInteger:=AIDreportarchive;
Open;
if AIDreportArchive>0 then
Edit
else
Insert;
BlobStream:=CreateBlobStream(FieldByName('Data'),bmWrite);
BlobStream.Seek(0,soFromBeginning);
ArchiveDevice.OutputStream:=BlobStream;
ArchiveDevice.Publisher:=ppReport.Publisher;
// ------------------------------
ppReport.SendEventNotify(ppReport,
ciReportBeforeAutoSearchDialogCreate, NIL);
ppReport.SendEventNotify(ppReport, ciReportGetAutoSearchValues, NIL);
// ------------------------------
ppReport.PrintToDevices;
BlobStream.Free;
Post;
AIDReportArchive:=FieldByName('ID').AsInteger;
finally
Close;
ArchiveDevice.Free;
ppReport.OnGetAutoSearchValues:=nil;
end;
end;
I'm using PrintToDevices to generate report to an archive.
PrintToDevices doesn't call the OnGetAutoSearchValues event.
It only works, when I call DisplayAutoSearchDialog before PrintToDevices.
You'll find my code at the end of this message.
Any ideas?
Thank you!
Lars Hirthe
CODE:
--------
...
var
BlobStream : TStream;
ArchiveDevice : TppArchiveDevice;
begin
...
ppReport.DeviceType:=dtArchive;
ArchiveDevice:=TppArchiveDevice.Create(nil);
with qryReportArchive do
try
ppReport.OnGetAutoSearchValues:=GetAutoSearchValuesFromParams;
Params[0].AsInteger:=AIDreportarchive;
Open;
if AIDreportArchive>0 then
Edit
else
Insert;
BlobStream:=CreateBlobStream(FieldByName('Data'),bmWrite);
BlobStream.Seek(0,soFromBeginning);
ArchiveDevice.OutputStream:=BlobStream;
ArchiveDevice.Publisher:=ppReport.Publisher;
// ------------------------------
ppReport.SendEventNotify(ppReport,
ciReportBeforeAutoSearchDialogCreate, NIL);
ppReport.SendEventNotify(ppReport, ciReportGetAutoSearchValues, NIL);
// ------------------------------
ppReport.PrintToDevices;
BlobStream.Free;
Post;
AIDReportArchive:=FieldByName('ID').AsInteger;
finally
Close;
ArchiveDevice.Free;
ppReport.OnGetAutoSearchValues:=nil;
end;
end;
This discussion has been closed.
Comments
Please see my previous response to this question.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com