Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert a picture dynamically 1

Status
Not open for further replies.

IlseH

Programmer
Aug 28, 2001
10
0
0
BE
Hi,

I really need some help here. I don't use Crystal Reports that often and normally I create my reports solely using Crystal Reports 8.5 Developer Edition. But now I've stumbled onto a problem.
I need a report with pictures of items. The path to these pictures is stored in our database. Now it seems that Crystal Reports can only load pictures dynamically if the pictures themselves are stored in the database, and that is not an option here.

So, I've been searching for a solution and I know it's possible, but my lack of knowledge makes it somewhat impossible to solve the problem. I know that you can integrate Crystal Reports with Visual Basic and I know there are two "ways"
- you can write a function in VB and load it into Crystal Reports
- you can program in VB and use Crystal Reports to visualize the report

The main question now is, how can I get this done. I'd rather write a funtion in VB which I can then load into Crystal Reports. So, how should the function be written (beware, I don't know Visual Basic) and what do I need to do in Crystal Reports to load the pictures into my report? How can I call the VB-function?

I really hope that one of you out there can help me out here.
Thanks in advance
 
If you are successful in writing a function within VB that pulls the picture onto the report, I would live to get a copy of it. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
To do what you want to do you will have to:

1. Using the CRW Designer in VB integrate your report into the VB project.

2. Insert picture object into the section where you want the graphics display.

3. Add code in the Section Format Event for the section that contains the picture object. The code will look something like:

Dim bmpHold As StdPicture
Set bmpHold = LoadPicture(App.Path & res\SampleBitmap1.bmp")
Set cObj.FormattedPicture = bmpHold

(Note. cObj is a name that was assigned to to Crystal Picture object)

4. This will dynamically change the picture at runtime based on a file location. FYI-If you save the rpt file using code do not expect the saved data to contain the dynmically load pictures. The output will show the loaded picture but the save rpt will just show the original contents.

 
PS: Look in the developer help for loadpicture this should point to a dicussion of dynamically loading picture. There is also a sample application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top