Dynamically change an image in a Crystal Report at runtime

后端 未结 8 1250
天命终不由人
天命终不由人 2021-02-04 08:08

I\'m using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the ima

相关标签:
8条回答
  • 2021-02-04 09:03

    The current version of Crystal Reports (for Visual Studio 2012+) that I use with Visual Studio 2015 supports this function. Follow the following steps:

    1. Insert a picture into your report. This will serve as your placeholder.'
    2. Right click your picture and choose Format Object
    3. Select the Picture tab and the press the formula button
    4. A formula window will open. Enter a formula that will find your pictures as links.

      if({@isDonor}="1") then "http://www.ny.org/images/aaf/picture1.jpg" else "http://www.ny.org/images/aaf/picture2.jpg" And you're done!

    0 讨论(0)
  • 2021-02-04 09:09

    Another option that I've found useful is inserting the pictures you would like to use. Position the graphic accordingly, then right-click the graphic and go to Format Graphic > Common. Check the Suppress box, then click the formula button, shown as x-2. Once in the formula window, simply add the code for determining whether the graphic should be suppressed or not.

    In my case, I was building one invoice template for multiple entities. In the formula window, I simply wrote COMPANY <> 1100 which meant that every time the invoice was run for a company other than 1100, the 1100 graphic would be suppressed.

    Hopefully this makes life easier...

    0 讨论(0)
提交回复
热议问题