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

manipulating or generating with tppcomponent from rtm files at run-time

edited September 2002 in General
Hello,

I am a new ReportBuilder user and I have some problems that are perhaps
obvious to solve
but I didn't realise how to do it

I would like to deal with some Tppcomponents that have been created at
design time
and saved in a foo.rtm file.
For instance, I would like to have an easy access at run-time to all the
components of TppDbText type (or of TppSubReport type) that have been saved
in my foo.rtm file, after I have loaded at Run-Time.

In the same kind of problems, I wander also how I can use "namely" the
Tppcomponents that have been created at design time and saved in my foo.rtm
file.

Thanks for any tips,
Bye.

Comments

  • edited September 2002
    After you have loaded the template, perform a report object loop. You can
    search through subreports as well in the report object loop. In the object
    loop, check to see if the component is a TppSubreport. By passing a report
    object in the function, you can recursively look for subreports by passing
    Subreport.Report when you find a subreport:


    procedure TForm1.AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
    var
    liBand: Integer;
    liObject: Integer;
    lObject: TppComponent;
    begin

    for liBand := 0 to aReport.BandCount-1 do
    begin
    for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
    begin
    lObject := aReport.Bands[liBand].Objects[liObject];

    if lObject is TppSubreport then
    AssignFontToReport(aFont, TppSubreport(lObject).Report)

    else if lObject.HasFont then
    lObject.Font := aFont;

    end;
    end;

    end;


    --
    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.