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

grouping objects on a band

edited May 2004 in General
In Ace, the objects on a band are 'children' of that band, such that I can
set the font properties of the band and these properties get applied these
'child' objects on the band. Is there a way to do something similar in RB?

Comments

  • edited June 2004
    Hi Rob,

    In ReportBuilder, each object belongs to a band by defining its "Band"
    property. This allows you to loop through each object in a certain band and
    change its properties any way you like. Check out the article below for an
    example of how this can be done. Note that you do not necessarily need to
    loop through all the objects in your report, you can limit the loop to a
    single band.

    ----------------------------------------------
    Tech Tip: Loop Thru All Objects in a Report
    ---------------------------------------------

    A ReportBuilder report is composed of a set
    of components. The basic structure is

    Reports.Bands[].Objects[]

    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.


    uses
    ppClass;


    procedure AssignFontToReport(aFont: TFont; 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.HasFont then
    lObject.Font := aFont;

    end;

    end;


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.