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

Getting List of Fonts Used In Report

edited March 2005 in General
Hi,

Does anyone know if there is an easy way to determine a list of fonts used
in a ReportBuilder report? I need to determine which fonts aren't a standard
Arial type font - that way I can embed them using the waler TExtraDevices
component.

Thanks,

Rhett Price

Comments

  • edited March 2005
    Hi Rhett,

    I would recommend creating a report object loop and checking the font of
    each text object. As you loop through each object, you can add each font to
    a list if it has not already been added. See the article below on looping
    through every object in a report.

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


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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