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

Template... Help please.

edited August 2004 in General
Dears,

I have a report in a file RTM. In execution time I load this report like
this:

ppReport1.Template.FileName := 'test.rtm';
ppReport1.Template.LoadFromFile;

In this report, I have a component ppLabel for which I need to allocate the
return of an existent function in my unit in Delphi. Is that possible? How
do I do?

Thanks,
[]s,
Alessandro Ferreira

Comments

  • edited August 2004

    Options:

    1. Use RAP code (i.e. the Calc workspace included with ReportBuilder
    Enterprise) to code an event-handler for the Label.OnPrint event. In the RAP
    event-handler call your Delphi function. Note: You can easily extend RAP
    with your custom functions that are registered to the CodeToolbox.

    2. Use Delphi code to code an event-handler for the Label.OnPrint event. The
    event-handler method must be a published method of the form/datamodule upon
    which the Report component resides. When the template is loaded, then the
    event-handler will be re-attached by the Delphi streaming system.

    3. Set the Label.Caption after loading the report template. The report and
    all components within it are Owned by the Form/DataModule. You can use the
    FindComponent method of the Form/DataModule to retrieve the object by name.

    var
    lLabel: TComponent;
    begin
    lLabel := FindComponent('myLabel');
    if (lLabel is TppLabel) then
    TppLabel(lLabel).Caption := 'myCaption';

    // or attach an event-handler

    TppLabel.OnPrint := myLabelOnPrintHandler;


    end;



    --


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004

    Thanks,
    []s,
    Alessandro

This discussion has been closed.