load dynamic image from path in crystal report

2019-08-14 19:21发布

I want to show an image in my report , I save path of image in my sqlserver database and now I want to load image from path .I search all of internet for that and try all of guidance , I first insert image into my report and after that I go to >Format Editor > picture > Graphic Location > and insert path of image into the textarea like this {Command.path} but when I run , it doesn't show any picture . Now how should I do ?
I use visual studio 2013 and latest version of crystal report .

3条回答
做个烂人
2楼-- · 2019-08-14 19:32

According to this, you're doing it right. Perhaps try to set a formula field equal to {Command.path} and use that instead to see if crystal just isn't parsing it properly? That way you can display the formula field and see how it displays. Perhaps you're storing it in the DB with quotation marks or spaces? Alternatively, using a parameter should definitely work, so you could make a sub-report with {Command.path} as a parameter that it uses to load up the image.

查看更多
Animai°情兽
3楼-- · 2019-08-14 19:34
Use a conditional formula to dynamically change the location of a report’s image.

1. Add an image to the report: -> Insert -> Picture
This image will act as a placeholder.
Ensure that the placeholder is the same size as the one that will be dynamically loaded, otherwise, the image will be scaled.

2. Change the image’s Graphic Location:
   ->right click image
   ->select Format Graphic…
   ->select Picture tab
   ->click the conditional-formula button (looks like x+2)
   ->set the formula’s text to the name of the formula or parameter field that will contain the image’s URL
   ->save the formula and click the OK button
   ->Save the report

It worked for me. 

Source: cogniza.com
查看更多
Juvenile、少年°
4楼-- · 2019-08-14 19:58

You can actually do it by:

  1. Add a datasource for your report. Be sure to include the path image.
  2. Add a default image.
  3. From Format Editor > picture > Graphic Location , add the path image field.
查看更多
登录 后发表回答