问题
HI I am running a Crystal Reports XI from .NET application. I am passing parameter name as company and report should display the logo depends on company.
How we can load the image dynamically in crystal report.(how to write formula to load the image from specific directory)
回答1:
A simple solution for Crystal Reports XI is to pass the image's URL as a parameter to the report, then use it as the picture's graphic location.
- Create a string parameter field, call it 'imageUrl'.
- Add an image (Insert | Picture...) to the report (it's a placeholder)
- Change the image's Graphic Location:
- right click image
- select Format Graphic...
- select Picture tab
- click the conditional-formula button (looks like x+2)
- set the formula's text to '{?imageUrl}' (without the single quotes)
- save the formula and click the OK button
- save the report
Run the report and set the imageUrl's value accordingly.
Alternately, you could use a CASE statement in a formula field for the same effect; simply change the image's conditional-formula field to reference the formula field instead of the parameter field.
回答2:
I don't think you can. The only way I've found to do that is to embed each image in a different section of the report and conditionally suppressing the section depending on the company parameter's value.
来源:https://stackoverflow.com/questions/2279270/how-do-i-load-images-dynamically-in-crystal-reports-xi