TECH TIP: Loop Thru All Objects in a Report
A ReportBuilder report is composed of a set of components. The basic structure is:
The bands and objects within the report can be accessed directly by object name or via the Bands and Objects array properties.
Below is an example of using the Bands and Objects array properties to change the font for all objects on a report.
Note that if you would like to loop through subreports within the report as well, you will need to add logic to recursively call the report object loop for each subreport when it is found.
procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
lObject := aReport.Bands[liBand].Objects[liObject];
//if the object is a subreport make a recursive call to this routine.
if (lObject is TppSubreport) then
if lObject.HasFont then
lObject.Font := aFont;