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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Ole Picture at runtime

Status
Not open for further replies.

oguraja

Programmer
Jun 14, 2003
124
US
Halo,

I use CR8.5 and Delphi 6. Can any one tell me a way to change the picture during runtime. It will be much helpful if u present a delphi sample code.

or else can we pass pictures as parameters to the report.

 
Since you didn't mention why you need to change the picture or where the picture is placed (i.e., how often it is printed) in the report and what purpose it serves, it's difficult to provide a good answer.

Having said that, the best way to change pictures is to store them in a database and either join to the table that contains them or use a subreport to get them. You can also use the section format event to point to a specific picture. I can't provide you with any Delphi code samples, as I work primarily with VB. The third option is to create the picture as a linked ole object, in which case the link is updated at runtime. But that is only practical for things like logos.

I don't believe you can pass pictures as parameters.
 
Actually i have to place the pictures in the report header to give description about a calculation.
I can say that its similar to logos. wat do u mean by linked OLE objects.
I cannot use the option of placing them in tables as they are in header.So please tell me about using section pointer and linked ole objects.
 
Well, the comment that you cannot place the pictures in a table because it is used in a header does not sound right to me. You could create a subreport in the report header to pull the picture.

As for the linked OLE Object, when you Insert the OLE Object, make sure you select Create from file and then check the "Link" checkbox. This will allow CR to update the object either at designtime or runtime as it changes.

As for using the section format event of the RDC, I don't have any sample delphi code. I would strongly recommend one fo the first two approaches over using the section format event.
 
In Crystal 8.5 when you liked the .bmp object you could remove the path and it would default to wherever the .rpt file was located. In Crystal 10, it defaults to a folder. How can you change this to be the folder where the .rpt file is located like in 8.5??
 
I've developed a utility (cViewIMAGE) to create a COM data source with an embedded image.

You create a subreport to use this data source and link the image file name. The image is dynamic and live at run time.

It requires Cr8.5 or later.

I've also done something similar with RTF/Text and HTML files and that works really well too.

Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top