Region height when using images
Hi,
I have a small problem on some reports that have region that includes images. For example, I have a region that has a memo aligned on top of the region (name of the doctor), just below it and on the left is one image (TppDBImage) that shows a bitmap of QR Code and on the right is another TppDBImage that shows the signature of the doctor.
- Memo is aligned to the top of the region, stretch = true.
- Left image (UPNQR) has Stretch := true, Autosize := true and MaintainAspectRatio := true.
- Right Image (ImgSignature) has fixed width (70mm) and height (25 mm), Stretch := True, MaintainAspectRation := True but Autosize := False.
In code Region.BeforePrint I have the following code:
Any ideas how to accomplish this? I am using ReportBuilder 21.04 with Delphi 10.4.
Best regards,
Goran
I have a small problem on some reports that have region that includes images. For example, I have a region that has a memo aligned on top of the region (name of the doctor), just below it and on the left is one image (TppDBImage) that shows a bitmap of QR Code and on the right is another TppDBImage that shows the signature of the doctor.
- Memo is aligned to the top of the region, stretch = true.
- Left image (UPNQR) has Stretch := true, Autosize := true and MaintainAspectRatio := true.
- Right Image (ImgSignature) has fixed width (70mm) and height (25 mm), Stretch := True, MaintainAspectRation := True but Autosize := False.
In code Region.BeforePrint I have the following code:
beginThe region's height is decreased if the left image (UPNQR) is not present but the region will not further decrease height if the Signature image is not present. If I switch on AutoSize on the image, then the region is decreased to the memo height which is what I would like to do but I want to limit the (maximum) size of the image of signature as defined.
DBImgSignature.Visible := not RacIzvajalec.FieldObjects['PodpisSlika'].isNull;
if RacIzvajalec.FieldObjects['PodpisSlika'].isNull then
begin
DBImgSignature.Height := 0;
end
else
begin
DBImgSignature.Height := 25;
end;
DBUPNQR.Visible := not RacunMaster.FieldObjects['UPNQRKoda'].isNull;
end;
Any ideas how to accomplish this? I am using ReportBuilder 21.04 with Delphi 10.4.
Best regards,
Goran
Goran Brumen
Audax d.o.o.
Audax d.o.o.
Comments
In a simple test, I am unable to recreate this behavior.
As my test case, I created a region with a memo at the top. Then I place two identical images side-by-side below the memo. One image had AutoSize set to True, the other False. I then set the visibility of each image to False in the Region.OnPrint event and the region snapped to the bottom of the memo as expected.
Are you able to recreate this with a simple example?
Is there a reason you are setting the height of the signature image to 0 when its visibility has already been set to False?
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I investigated the problem further after sending the question. I already solved it but it required intervention in my software.
The problem was with the field value for the signature image (AutoSize = False) was never completely null but had a some data (a byte or so) which resulted that the field was not null and at the same time not enough data to show any image. If AutoSize would be turned on, then the code behind the component would recognize unusable data and the height of it would be 0. Since I do not perform any resampling of the signatures within Delphi, I need to have AutoSize to False.
Numerous report templates go through same print procedure so I updated the print code in Delphi which checks for usable data. If there is no usable data to show the image, the field value should be null thus the code in RTM in my first message is working. Without any need to change height of the TppImage.
Sorry for taking Your time with the question.
Audax d.o.o.