Q: Print existig Reports together
HI together
A customer want to Print Reports in Queue.
That means:
if he print one report so during (or after) printinn the next one should
be loaded an printed.
I meant there should be a main report and then within them at least one
subreport. And before printing the subreport the report definition
(repo.rtm) should be loaded into Subreport.
Or how am I able to do this during runtime ?
Thanks for a Tip from Erich
Zürich - Switzerland
A customer want to Print Reports in Queue.
That means:
if he print one report so during (or after) printinn the next one should
be loaded an printed.
I meant there should be a main report and then within them at least one
subreport. And before printing the subreport the report definition
(repo.rtm) should be loaded into Subreport.
Or how am I able to do this during runtime ?
Thanks for a Tip from Erich
Zürich - Switzerland
This discussion has been closed.
Comments
This can be done fairly easily by dynamically createing a subreport in code
and then loading a saved report template into that subreport. This can be
done for multiple subreports if needed.
Below is an article on createing a subreport in code. Then you can use the
Template object of the subreport to load the template after it has been
created. For example...
Subreport.Report.Template.FileName := 'c:\myReport.rtm';
Subreport.Report.Template.LoadFromFile;
-------------------------------------------------
TECH TIP: Creating a SubReport in Code
-------------------------------------------------
A subreport is comprised of two objects:
1. SubReport control
The subreport control is added to a band of the
'parent' report. It has properties such as
ShiftRelativeTo, PrintBehavior, etc.
In the Report Designer, the subreport is drawn
as a rectangle.
2. ChildReport
The child report is a descendant of CustomReport and has
most of the same properties as a standard Report.
The child report has a separate layout workspace in the report
designer that is accessible by selecting the tabs at the bottom
of the designer.
When dynamically creating a subreport in code you need to create the
subreport and the underlying child report. The subreport.Report property can
then be used to access the child report.
This is demonstrated in the following example:
var
lSubReport: TppSubReport;
lReport: TppChildReport;
lLabel: TppLabel;
lDBText: TppDBText;
begin
lSubReport := TppSubReport.Create(Self);
{add to the main report's detail band}
lSubReport.Band := ppReport1.DetailBand;
{create the child report (parameters: main report) }
lSubReport.CreateReport(ppReport1);
lReport := TppChildReport(lSubReport.Report);
{assign a datapipeline}
lReport.DataPipeline := plCustomers;
{create the default set of bands}
lReport.CreateDefaultBands;
lLabel := TppLabel.Create(Self);
lLabel.Band := lReport.TitleBand;
lLabel.Caption := 'Customers';
lLabel.Font.Name := 'Times New Roman';
lLabel.Font.Size := 24;
lDBText := TppDBText.Create(Self);
lDBText.Band := lReport.DetailBand;
lDBText.DataPipeline := plCustomers;
lDBText.DataField := 'CustNo';
lDBText.Color := clYellow;
lDBText.Font.Name := 'Times New Roman';
lDBText.Font.Size := 12;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com