views:

2184

answers:

1

I have a VB.NET application which needs to generate reports (invoices) which contains optional images. The images are going to be loaded into 1 of 6 places on the report, but will reside on the client PC (deployed with the application). I've been trying to access the ICROleObject object, which is what's placed onto the report, but I can't locate this interface in the object browser, even. As this is the object's interface, I figured that it would let me access it if only I could cast it:    

 CType(r.ReportDefinition.ReportObjects("picTL"), ICROleObject)
Any ideas where I would find this, or if I'm even approaching this correctly?
I've tried following the directions at http://www.idautomation.com/crystal/streaming_crystal.html, and that won't work with the version of Crystal which is embedded in .NET 2008. Neither will the solution found at http://www.a1vbcode.com/a1vbcode/vbforums/Topic25620-3-1.aspx#bm25974, although that one looks a bit more promising, and is the one I'm trying to model after.
If I have to use a dataset & a series of subreports, I suppose could ... but that method just doesn't seem as straightforward as this one.

A: 

You should cast it as a PictureObject instead. The type "PictureObject" is found in the CrystalDecisions.CrystalReports.Engine namespace.

Ex:

Dim pic = CType(rapportCourant.ReportDefinition.ReportObjects("Picture1"), PictureObject) pic.ObjectFormat.EnableSuppress = True

You can then suppress ou enable the picture object as you need it.

Thanks, Karl - and my apologies for not replying sooner (I'd forgotten which OpenID I used to log in here, and haven't been able to resolve it until now).I will keep your comment for future use.For the time being, though, I solved the problem by using ImageMagik to size all of my images to fit the appropriate picture boxes on the report, and load in a blank one if there's no need for a picture in that location.
David T. Macknet