Add Image To Crystal Report At Runtime

15,504

If you want to store the logo on disk instead of in the database:

  1. In Designer, insert a placeholder image.
  2. Right-click the placeholder image, and click Format Graphic. On the Picture tab, next to Graphic Location, click the formula button. Enter the path there, or provide a formula which provides it.

At runtime, Crystal will substitute the image from the file.

If you want, you can use a parameter field in your formula. That way you can provide the path programmatically at runtime.

Share:
15,504
Reafidy
Author by

Reafidy

Commercial Helicopter Pilot/Aviation Maintenance Controller. Part time programmer. Administrator @ www.ozgrid.com/forum VBA, VB, C#, .NET, ASP.NET, SQL, Android, Java

Updated on June 06, 2022

Comments

  • Reafidy
    Reafidy almost 2 years

    I would like to add an image to a crystal report at runtime.

    I am currently doing this using a second data table containing only a byte field and then a blob field on the report. However this feels like a hack and if there is no data in the first primary table then for some reason the image does not show.

    Is it possible to add an image with code or another method?

    I'm using crystal reports for visual studio 2010. Winforms project. Either C# or VB.

  • Ryan
    Ryan over 12 years
    I'll need this one day. If using CR2008: Right-click image -> "Format Graphic" -> "Picture" tab -> "Graphic Location:" -> Enter file path as string
  • paulmelnikow
    paulmelnikow over 12 years
    Thanks! I added that detail to the post.
  • Keith
    Keith almost 8 years
    I tired this via two methods: using a parameter as the full location of the file and as just the filename of the location (directory). Both unfortunately prompt me for the parameter when the report loads even though I'm clearly setting the parameter's value. Any idea?