Components In Subreports
Is there a way to only access components within a certain section subreport?
The reason I ask I have a report made up of many section subreports. But
only one of these subreports is used, the other's visible property is false.
However, there are certain component properties within the subreport that I
need to modify. As it is right now, my code evaluates every component
within the entire report, thereby causing the report to take a very long
time to appear. By accessing only those components within a subreport whose
visible property is true, would greatly reduce the processing time thereby
displaying the report faster.
--
Jeff Kreider
The reason I ask I have a report made up of many section subreports. But
only one of these subreports is used, the other's visible property is false.
However, there are certain component properties within the subreport that I
need to modify. As it is right now, my code evaluates every component
within the entire report, thereby causing the report to take a very long
time to appear. By accessing only those components within a subreport whose
visible property is true, would greatly reduce the processing time thereby
displaying the report faster.
--
Jeff Kreider
This discussion has been closed.
Comments
loop through the controls of a report. In fact, I don't think that just
looping through the report bands will reach the controls on a subreport.
Here is a recursive routine I use to set all the controls on a report to
black font. You should be able to see how to loop through just a chosen
subreport from this.
procedure AssignBlackFont(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
with lObject as TppSubReport do begin
AssignBlackFont(report);
end;
if lObject.HasFont then
lObject.Font.color := clBlack;
end;
end;
HTH
Sarah