Printing images from a directory using tppReport
Hello,
I want report builder to print out a document filled with images, wich are
pressent in a certain directory.
(i want to do this in 1 print command, so our printer can put a staple
thru those pages)
my idea was :
- use a TppReport object on my Main form.
- Loop thru a filelistbox
- and for each item create (in the Report object) a new Page
- in that new page create an Image object and set the size to page size
- let the image object loadfromfile (filelistbox.items.strings[index])
the next imagefile
but i can't seem to find the right objects / documentation to realize this.
someone, please help me !
--- posted by geoForum on http://delphi.newswhat.com
I want report builder to print out a document filled with images, wich are
pressent in a certain directory.
(i want to do this in 1 print command, so our printer can put a staple
thru those pages)
my idea was :
- use a TppReport object on my Main form.
- Loop thru a filelistbox
- and for each item create (in the Report object) a new Page
- in that new page create an Image object and set the size to page size
- let the image object loadfromfile (filelistbox.items.strings[index])
the next imagefile
but i can't seem to find the right objects / documentation to realize this.
someone, please help me !
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
Please use your full name when posting to these newsgroups.
I would suggest following the list you have below except for each image,
create a Section style subreport and place it into the detail band of the
main report. Then place the image inside the subreport. This will
effectively give you a separate page for each image. See the article below
on creating subreports in code.
-------------------------------------------------
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;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com