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

How can I find a component in a Report out of delphi

edited February 2004 in General
Hi,

what I want to do is to locate a chart in a report to work with it within
delphi. How can I find the chart in the report. There is a FindComponent
function but I just find the bands, right? Do I have to recall FindComponent
for each band?

--

Mit freundlichen Gr??en
Sven Langenkamp

Tel.: +49 (0) 50 21 / 97 24 -15
Email: langenkamp@ctdatentechnik.de

===============================
CT Datentechnik Gesellschaft
f?r Prozessrechentechnik mbH
Eschenstr. 2 - 31582 Nienburg
Tel.: +49 (0) 50 21 / 97 24 -0
Fax: +49 (0) 50 21 / 97 24 -18
Email: info@ctdatentechnik.de
Internet: www.ctdatentechnik.de
===============================

Comments

  • edited February 2004
    Hi,

    The easiest/best way to locate a component in a report is to use a report
    object loop. See the article below for more information.

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