printing jpeg
Hi all
I'm trying tp print some jpegs using this code, but it does not change
Center and MaintainAspectRatio
ppReport1.Template.FileName := PathToFile+'spiral.rtm';
Try
ppReport1.Template.LoadFromFile;
except
showmessage('Problem med udskrift af Spiral!!!!');
exit;
end;
ppimage1.Picture:=image3.Picture;
ppimage2.Picture:=image4.Picture;
if Checkbox7.Checked then
ppImage2.Center:=True
else
ppImage2.Center:=False;
if Checkbox9.Checked then
ppImage2.MaintainAspectRatio:=True
else
ppImage2.MaintainAspectRatio:=False;
ppReport1.Print;
I'm trying tp print some jpegs using this code, but it does not change
Center and MaintainAspectRatio
ppReport1.Template.FileName := PathToFile+'spiral.rtm';
Try
ppReport1.Template.LoadFromFile;
except
showmessage('Problem med udskrift af Spiral!!!!');
exit;
end;
ppimage1.Picture:=image3.Picture;
ppimage2.Picture:=image4.Picture;
if Checkbox7.Checked then
ppImage2.Center:=True
else
ppImage2.Center:=False;
if Checkbox9.Checked then
ppImage2.MaintainAspectRatio:=True
else
ppImage2.MaintainAspectRatio:=False;
ppReport1.Print;
This discussion has been closed.
Comments
This is most likely due to the fact that you are loading a template, then
accessing the image components by name. The fact that this code compiles
lets me knowt that ppImage1 and ppImage2 already exist somewhere in your
project before the template is loaded. When you then load the template, the
images will not be named the same.
I recommend creating a report object loop to find the image components after
the template is loaded, then using those references to alter the images.
----------------------------------------------
Tech Tip: Loop Thru All Objects in a Report
---------------------------------------------
A ReportBuilder report is composed of a set of components. The basic
structure is
Reports.Bands[].Objects[]
The bands and objects within the report can be accessed directly by object
name or via the Bands and Objects array properties.
Below is an example of using the Bands and Objects array properties to
change the font for all objects on a report.
uses
ppClass;
procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont then
lObject.Font := aFont;
end;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com