How do I load images dynamically in Crystal Reports XI

Nag picture Nag · Feb 17, 2010 · Viewed 16.4k times · Source

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)

Answer

craig picture craig · Feb 17, 2010

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.