PrinttoDevices and Subreports
Hello All:
For dot-matrix printing, I use your PrintToDevices method, then pull out
the text & positions of each report component, then print them using my own
Escape Code sequences. Everything works great.
I have added a subreport into one of the reports. The subreport data
appears on the preview but my app cannot access the subreport components.
I am trying to access each report component by looping through the form
(that owns the ppreport ) and identifying any TppDBText component.
How do I access the subreport components ??? My guess is that the
subreport components are owned by the subreport and that the subreport is
owned by the form . Is this correct ???
Given my code below, would I need to loop on the subreport component to
extract each TppDBText component within the subreport ???
Any help would be appreciated. Thank you.
ppReport2.PassSetting:= psTwoPass;
//memo1.lines.add('pass setting set psTwoPass');
lDevice := TppDevice.Create(fmReport);
lDevice.PageSetting := psLastPage; // See ppTypes
lDevice.Publisher := ppReport2.Publisher;
ppReport2.CachePages := True;
ppReport2.PrintToDevices;
For I:=0 To (fmReport.ComponentCount-1) do
begin
If fmReport.Components[I] is TppDBText Then
BuildReportNXDBText(I)
end;
For dot-matrix printing, I use your PrintToDevices method, then pull out
the text & positions of each report component, then print them using my own
Escape Code sequences. Everything works great.
I have added a subreport into one of the reports. The subreport data
appears on the preview but my app cannot access the subreport components.
I am trying to access each report component by looping through the form
(that owns the ppreport ) and identifying any TppDBText component.
How do I access the subreport components ??? My guess is that the
subreport components are owned by the subreport and that the subreport is
owned by the form . Is this correct ???
Given my code below, would I need to loop on the subreport component to
extract each TppDBText component within the subreport ???
Any help would be appreciated. Thank you.
ppReport2.PassSetting:= psTwoPass;
//memo1.lines.add('pass setting set psTwoPass');
lDevice := TppDevice.Create(fmReport);
lDevice.PageSetting := psLastPage; // See ppTypes
lDevice.Publisher := ppReport2.Publisher;
ppReport2.CachePages := True;
ppReport2.PrintToDevices;
For I:=0 To (fmReport.ComponentCount-1) do
begin
If fmReport.Components[I] is TppDBText Then
BuildReportNXDBText(I)
end;
This discussion has been closed.
Comments
It is better to use a Report Object loop to find a given component in a
report. Then when you run across a TppSubreport, you can loop through that
report (recursively) and make the changes you need. Something like the
following...
uses
ppClass,
ppSubRpt;
procedure FindDBTexts(aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if (lObject is TppSubreport) then
FindDBTexts(TppSubReport(lObject).Report)
else if (lObject is TppDBText) then
BuildReportNXDBText(lObject);
end;
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com