Reputation: 2014
Is it possible to set maximal height of a picture in crystal report and preserve original ratio of a picture? If can grow is disabled, every picture is streched or shrinked to default picture object size, if is enabled, I'm losing limits of picture size. I'm using crystal reports for VS 2013 (13.0.5)
Upvotes: 2
Views: 10549
Reputation: 190
This works in Crystal Developer 11
Note: if the image is way to small then the aspect ratio is compromised, but if image is big enough (like half the page or full page) then ratio is correct
Upvotes: 0
Reputation: 622
Perhaps too late, but when you right click on picture -> shaping of the object You've a checkbox "modular size", uncheck it and put manually the size you want on Image tab.
Upvotes: 0
Reputation: 101
Actually I solved this problem for Visual Basic 5.0 and Crystal Reports 6.0 (Seagate version). You asked the newer version but maybe this gives you an idea to solve the problem or it may help some other guys searching an answer for their problems.
Before you assign the report source you can change the height of the picture:
Set crxFieldObject = Report.Sections.Item("D").ReportObjects.Item(269)
crxFieldObject.Height = theNewHeight
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
PS: After you assign the report source you can not change the height property. Below code does NOT work:
Private Sub Section3_Format(ByVal pFormattingInfo As Object)
Picture1.Height = theNewHeight 'this code does NOT work
End Sub
In this code:
.Sections.Item("D")
means the Detail Section of the report and
.Item(269)
means the Picture Object. After you insert an OLE Object you can check the item number with a small code such as:
aa = Report.Sections.Item("D").ReportObjects.Count
For i = 1 To aa
Set crxFieldObject = Report.Sections.Item("D").ReportObjects.Item(i)
bb = crxFieldObject.Name
If Mid(bb, 1, 7) = "Picture" Then
crxFieldObject.suppress = False 'You can put a BreakPoint here to check the value of i
End If
Next i
Hope it helps
Upvotes: 4
Reputation: 12590
The answer is No. I did many tests and researches and I didn't found any way to control the height and, without controlling the height, it's not possible to fit an arbitrary image in the object box and keep is ratio at the same time.
Looks like it's and old problem.
But if all your images are limited to the same dimensions, like you have set your limits to 500x500, so you can have, for example, images that do 500x200, 500x500, 250x500, etc., there's a way to do it.
The object box needs to have the same ratio as your limits. In my example, 500x500, the ratio is 1:1 (square) so your object box needs to be square also. You need to check Can grow
and, in the Image tab, set the size exactly like the object box's size. You also have to set the bitmap image size (right-click on the box, choose Bitmap Image Object then Modify) to the image limits (500x500).
Upvotes: 0