cancel
Showing results for 
Search instead for 
Did you mean: 

Set the Picture property of ReportDefinition PictureObject at runtime

Former Member
0 Kudos

This was possible with Crystal 9 using the read/write FormattedPicture property at runtime - the equivalent property with Crystal 2008 is read only??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, Grant;

The functionality you were using to change the picture and font at runtime was the format events of the Report Design Component (RDC).

Visual Studio .NET does not support events in the same way and Crystal Reports 2008 no longer includes the RDC.

The only way to make changes to the structure of the report now is to use the Report Application Server (RAS) functionality.

Changing the Picture object at runtime has gotten simpler and that is not necessary. Here is an article that describes how to change the location of the OLE Object at runtime. (It overcomes an issue in a Web application but the same method will work in a Windows application.)

[Click|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]

By creating a Graphic Location on a formula field in the report designer, you just need to pass in a new formula with the correct path at runtime and the new object will display.

Elaine

Former Member
0 Kudos

Thanks Elaine - I did see that property in the designer - to implement this I'll have to create a formula on the fly in each report (if it doesnt exist) - set the formula text - and then set the graphic location.

We also used to set the picture objects size and width according to the size of the image - but I may see if we can avoid that if we go down this path.

I have a few options to try now so will post my 'final solution' when I conclude a few more trials.

Former Member
0 Kudos

I'm going to use this approach because using the RAS API didn't seem to actually affect the report when previewed. I've tried to use RAS instead to manipulate a few hundred reports to add this new formula - but am struggling to get the crsytal reportdocument.save or the RAS reportclientdocument.saveas function to work - neither seem to actually persist my changes to file. Still working on this...

Former Member
0 Kudos

Hello Grant,

it might save you some time if you see a ready CS sample for VS 2005 [How to add an Image|ftp://ftp.businessobjects.com/pub/incoming/NET-CS2005_RAS-Unmanaged_CR115_Add_Image.zip].

This sample demonstrates how to add an image using unmanaged inproc RAS.

Best regards

Falk

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Please send code used in CR 9. Also, include the following information:

What Crystal reports SDK were you using in CR 9?

What Crystal reports SDK are you using with CR 2008?

Do you have the latest Service Pack for CR 2008?

What is the end goal of this? E.G.; why do yo need the property to be read/write?

Ludek

Former Member
0 Kudos

Thanks for replying.

In crystal 9 we did this:

Section.ReportObjects(i).FormattedPicture = New Bitmap(FileName)

We also changed the Fonts at runtime (another post).

Thie images are updated at runtime so that our customers can use their own logo images on reports, and change the location or name of images as configured in our db. We change fonts on the fly in Crystal 9 to overcome some issues with our default design time font (Arial) when running in some asian/arabic/kana languages etc. It also allows us to update the look and feel of hunrdeds of reports at runtime without having to actually open and edit the reports.

It has been suggested in response to another post (regarding Fonts) to use the RAS api - I'm trying that now by setting the .LinkedURI property of the RAS PictureObject.

I havent tried this code yet so will update the thread when I have more info.