BeforePrint problem
I am using templates to create a range of reports from a set of standard
subreports. I am using the following code to add them to a master report:-
dmJobDetails := TdmJobDetails.Create(Self,
ProjectManager.CurrentProject);
srJobDetails.Report.Template.FileName :=
TemplatePath + 'Structural\Reports\JobDetails.rtm';
srJobDetails.Report.Template.LoadFromFile;
srJobDetails.DataPipeline := dmJobDetails.jitJobDetails;
ppJobDetailsChildReport.Detail.BeforePrint :=
dmJobDetails.SupportedTrussesBeforePrint;
I am trying to modify the visibility or color of various subreport
labels bu assigning the BeforePrint event of srJobDetails (the local
empty subreport in the master report) to a handler in the dmJobDetails
module. This handler then sets different visibility etc for the
subreport loaded as a template. Although the event handler is called no
changes to the labels occur. This seems to be related to the fact that
the report is loading templates. Any suggestions as to what I am doing
wrong?
subreports. I am using the following code to add them to a master report:-
dmJobDetails := TdmJobDetails.Create(Self,
ProjectManager.CurrentProject);
srJobDetails.Report.Template.FileName :=
TemplatePath + 'Structural\Reports\JobDetails.rtm';
srJobDetails.Report.Template.LoadFromFile;
srJobDetails.DataPipeline := dmJobDetails.jitJobDetails;
ppJobDetailsChildReport.Detail.BeforePrint :=
dmJobDetails.SupportedTrussesBeforePrint;
I am trying to modify the visibility or color of various subreport
labels bu assigning the BeforePrint event of srJobDetails (the local
empty subreport in the master report) to a handler in the dmJobDetails
module. This handler then sets different visibility etc for the
subreport loaded as a template. Although the event handler is called no
changes to the labels occur. This seems to be related to the fact that
the report is loading templates. Any suggestions as to what I am doing
wrong?
This discussion has been closed.
Comments
How are you accessing the report components once you load the template?
Note that new names will be given to each report component as they are
created at runtime (when the template is loaded).
The best way to access report components at runtime is to use a report
object loop. See the following article on how this can be done.
http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Report_Object_Loop
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Solved this one using FindComponent - finally understood what was going
on ...
Paul