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

document font

edited May 2003 in General
Hi

I use Delphi 6 and ReportBuilder 6.03.

Is their default font on ReportBuilder which I can change so that all labels
and dbtext fields are changed.

My users can choose their own font for the reports.
I remember in QuickReport their you had an Font property which was
applicable for the whole report. If you changed this font then all the fonts
of all labels and dbtext fields were changed.

Thanks
Andre

Comments

  • edited May 2003
    Andre,

    You can use a report object loop to change every component to a specific
    font. Below is an example of how you might do this. This tech-tip along
    with many others can also be found in our Tech-Tips newsgroup
    (digital-metaphors.public.reportbuilder.tech-tips).

    ----------------------------------------------
    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.