Configuring default template
Alexander,
you mentioned previously (thread 'configuring template for end user report')
<<
You must specify the file to load from. ie.
Report.Template.FileName := 'mytemplate.rtm';
Report.Template.LoadFromFile;
I am assuming this should be in the Create Report event of the Report
Explorer:
procedure TDataModuleReportExplorer.ReportDesignerCreateReport(
Sender: TObject; const aDataName: String; var aReport: TObject);
begin
Report.Template.FileName := myFileName.rtm';
Report.Template.LoadFromFile;
end;
However, this does not load the template . . .
Any other ideas?
Thanks,
Lauchlan Mackinnon.
you mentioned previously (thread 'configuring template for end user report')
<<
You must specify the file to load from. ie.
Report.Template.FileName := 'mytemplate.rtm';
Report.Template.LoadFromFile;
I am assuming this should be in the Create Report event of the Report
Explorer:
procedure TDataModuleReportExplorer.ReportDesignerCreateReport(
Sender: TObject; const aDataName: String; var aReport: TObject);
begin
Report.Template.FileName := myFileName.rtm';
Report.Template.LoadFromFile;
end;
However, this does not load the template . . .
Any other ideas?
Thanks,
Lauchlan Mackinnon.
This discussion has been closed.
Comments
option from the designer file menu. To load a template when the designer
first open use the Report.Template.OnNew event.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Thanks Alexander.
Lauchlan Mackinnon.
Actually, that;s what I want. This event does not seem to fire though (I
have a breakpoint there that it doesn't reach).
the new report wizard finishes creating the report. The OnNew event will
fire both, when the user first opens the designer and when they select the
new report option from the designer menu. The CreateReport event you can
assign at design time on the designer component. The OnNew event you can
assign in the FormCreate for your application. If the event aren't firing
just make sure that they are not being reassigned anywhere else.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
when
Alexander,
I now have
procedure TDataModuleReportExplorer.DataModuleCreate(Sender: TObject);
begin
Report.Template.OnNew := NewReportHandler;
Report.Template.OnLoadEnd := LoadEndEvent;
ReportDesigner.Viewer.ZoomSetting := zsPageWidth; // or whatever setting
end;
procedure TDataModuleReportExplorer.NewReportHandler(Sender:TObject);
begin
Report.Template.FileName := 'ReportDefault.rtm';
Report.Template.LoadFromFile;
Subreport1.Report.Template.FileName := 'myHeader.rtm';
Subreport1.Report.Template.LoadFromFile;
end;
It loads the report in the design tab and I see the subreport band, ir it
seems in the design tab to load exactly as I want. When I go to preview
however, it tries to load a datasource where the driver etc aren't specified
(ie, one I didn't create) and crashes out.
Nonetheless, it is progress! Everything works as desired until I try to use
preview tab.
Why would it invent a fictitious datasource?
I have two templates. One is loaded into the report, and has a title,
header, detail and footer band. The title band has a subreport, into which I
load the second template which has a title and detail band. The title band
has only 1 image and 1 caption (no data). I set the subreport up with a
pipeline to try to appease the above behaviour, but it makes no difference.
What do I need to do next?
Thanks,
Lauchlan Mackinnon.
reconnected to some specific data source. That data source should reside in
the data module with the report object into which the templates are being
loaded.Basically be sure to reconnect the report and the subreport to valid
pipelines with the same field that the report expects.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
"Alexander Kramnik (Digital Metaphors)" wrote
being used by anything in the report which could cause this problem.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com