crystal reports image squashed

2019-02-24 10:57发布

问题:

is there any way in crystal reports(v11, if this matters) to prevent the images from stretching itself to fit in the whole OLE-object? im loading the images dynamically from a database and dont know their aspect ratio.

thanks for help.

回答1:

i found the answer here

To make the image resize properly, you must perform the following steps in order:

  1. Set the image's EnableCanGrow to true
  2. Calculate and set Width and Height to the needed size
  3. Set the image's EnableCanGrow to false
  4. Fill the DataSet's image object with data
  5. Continue with normal report processing.

If you get these items in the wrong order, or skip an item, you will find that Crystal Reports scales the image in unexpected and unrecoverable ways.



回答2:

The Crystal OLE object, which shows pictures from files, can only be set programmatically so for a 'pull' type report, where you are supplying a dynamic image name, of either portrait or landscape orientation, at least one of those orientations will get squashed to fit. It is better, IMHO, to show thumbnails and then have a calculated hyperlink to show the real picture in some decent viewer. You will spend an unreasonable amount of time trying to get the OLE object that shows pictures to understand that your image has a different aspect ratio. As long as it is at least reasonably legible that may have to suffice.



回答3:

I don't think Crystal can help you. Try looking for some kind of command-line based app on the internet which can automically resize pictures (add black space, reduce in a 1:1 ratio, etc). I'm sure they're out there.