How to insert dynamically images in Crystal Reports
First, add a graphic as a placeholder into your report where you want it to display. Then, right-click the graphic -> 'Format Graphic' -> 'Picture' tab -> Add a formula under 'Graphic Location' that builds your path string. Something like 'C:\Id Maker\' + {table.Clgid} + '.jpg'
should work.
Related videos on Youtube
Admin
Updated on June 14, 2022Comments
-
Admin over 1 year
I am developing a WinForms App which can generate a report of my college students.
I am using Crystal Reports but I don't know how to retrieve student photos from the file system.
Student photos are stored on the file system and use this naming convention:
C:\Id Maker\"Clgid".jpg
Where
Clgid
is a value stored in a database.As an example, my
Clgid
isAAAAAAA
which links to my photo on the file system asC:\Id Maker\AAAAAAA.jpg
I am struggling with how I can look up the database value of
Clgid
and then retrieve the photo from the file system so I can display it in my Crystal Report. -
Ryan almost 12 years@DineshGehlot It's not working? Does any pictures load? All I can suggest if it is not working is to verify the file names and paths are correct and that the paths are local to where the report is run.
-
Keith over 9 years@Ryan This doesn't seem to work for me. I'm using a Crystal Report "viewer" that I can scroll through my individual reports with First/Next/Previous/Last button. The only image that loads whether I pass it with the other information on the report or not, is the default image. I tried using the database method as you suggested, but it just hangs when it attempts to load the image, eventually (sometimes) loads, and then still has the default image. Any ideas?
-
Ryan over 9 years@Keith It sounds like CR can't find the image/path (see my comment above). If you have a small number of images, you may also try embedding each image you want to display in the .rpt itself. You can stack them and then selectively suppress them so only one displays for each row.
-
Keith over 9 years"...and that the paths are local to where the report is run" -- What do you mean? I can't give it a direct path like: "C\Test\123.jpg" if the CR isn't ran from there?