BOFocus – Crystal Reports Tips – Tricks – Tutorials

Crystal Reports - Design

Change an image in the Crystal Report at runtime

So, you have created a great report for one department and another department wants the same report, only with their logo and department header information?  No problem, we’ll show you how you can setup a report to change the page header information based on a parameter.  In the example below, we’ll be using the xtreme database and filtering/displaying information based on the country.

1. Open your report.

2. From the design tab,  right click on ‘Page Header’ and click on ‘Insert section below’. The page header will now be divided into two sections, ‘Page Header a’ and ‘Page Header b’

3. Within Page Header a and b, insert your images, text, heading, and column header information for each section.  In my example below, I am using two counties,  Canada and France.

4. Now create a parameter that will control which Page Header which to display at run time.  From the Field Explorer, right click on ‘Parameter Fields’ and click on ‘New’

5. Set your parameter as a ‘String’ type and ensure that it is static.  In this example, I’ve added two default values, Canada and France, while ensuring that ‘Allow multiple values’ is set to false.

6. Incorporate your parameter into your select statement,   From the tool bar, click on ‘Report’, ‘Select Expert’.

7. In the field dialog box, select Country (in this example) , then click OK

8. Choose the parameter from the drop-down list. {?Country} and click OK.

9.  From the design tab,  right click on ‘Page Header a’ and click on ‘section expert’.

10. Ensure that ‘Page Header a’ is highlighted, and click on the ‘X-2′ icon tot he right of ‘Suppress (No Drill-Down)

11. In the Formula workshop, under Report Fields, double click on your parameter.  In my example, The information for Canada was in report header a, France b. You will want your parameter to not equal itself.   Repeat this step for each page header section you recreated.

12. Save and Close

13. Press F5 to refresh your report, selecting your parameter value when prompted.

You can download my sample here

Tagged , ,

3 thoughts on “Change an image in the Crystal Report at runtime

  1. trapped

    Subject should be “Change a section in the Crystal Report at runtime”
    Not a good example for images.

  2. bkuipers Post author

    Thank you for your feed back Trapped. For those who store images outside a database and wish to change a logo/picture at runtine, the above example is what works. What type of information are you looking for? Maybe we can help.

  3. Franko

    Is it possible to set a byte[] to a “formula field” dynamically during runtime, So that i can dynamically display images in the crystal report using a formula field. I dont want to put the byte array in a dataTable and then use it. My question is very specific about Formula fields. Thank you.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Use the Chart Sort Order dialog box to sort and group your chart data. This dialog box appears when you click the Order button on the Data tab of the Chart Expert for a chart with the Advanced layout type.