?
Solved

crystal reports how to display an image dynamically in code from asp.net

Posted on 2006-04-21
17
Medium Priority
?
2,850 Views
Last Modified: 2010-05-18
Hello Experts!
My problem is I am trying to create a re-usable report that can be used for many customers.  I customize each report with an image logo for that customer.  The reports are run from an asp.net web page.  I am using Crystal version 9, and I have read posts that not until version 11 can you dynamically display an image to the report, in version 9 only the link shows which is unacceptable.  So, is there a way in asp.net to set the location of this image to a path or URL, and how would I do this?
0
Comment
Question by:tegronakron
  • 9
  • 7
17 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 16507742
As far as I know in version 9 your only option for a dynamic image would be to put the image itself inside your database as a BLOB (instead of just putting a path to the image).  This does work just fine, but the downside is that it's a lot of additional storage space needed in your db to hold the images.

frodoman
0
 

Author Comment

by:tegronakron
ID: 16509563
I thought there was a way in the vb code to assign the image to a path?
I tried to do it this way, but was unable to figure it out.

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20915695.html?query=crystal+reports+image+path&clearTAFilter=true
0
 
LVL 42

Expert Comment

by:frodoman
ID: 16509818
I may have misread your question.  So you want a single image per report?  What you'll want to do then is always have your image in the same place (c:\logo.bmp for example).  To put the image in Crystal:

Insert -> OLE Object -> Create From File.  Now browse to the image (c:logo.bmp or wherever) and make sure you've checked the "link" box right below the file path.  Now you can change your image (copy a different image to c:\logo.bmp) and next time the report is opened the new image will be used.  Note that it will only update when you RE-OPEN the report - simply refreshing won't do it.
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

Author Comment

by:tegronakron
ID: 16509956
I tried exactly what you said there.  It looks like it creates an icon instead of the actual image in Crystal Design view and also when I run the report?  Any reason that would be?  I am exporting to a pdf file in case that makes a difference.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 16510061
Is your image a .bmp?  I don't think this works properly with other formats because Crystal internally converts other images to bitmaps.
0
 

Author Comment

by:tegronakron
ID: 16510175
well I tried it with a converted bitmap, I will try it with an original bitmap
0
 

Author Comment

by:tegronakron
ID: 16510246
I created a bitmap in paint and then inserted it to my crystal report as an ole object with a link.  Still shows up with an icon and the test.bmp text below it.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 16510292
When you insert an OLE-Object there is a checkbox for "display as icon" - make sure this is NOT checked when you insert the object.  Sounds like it may have been - if you double-click on the icon does the bmp open in MS Paint (or whatever default editor you have set)?

0
 
LVL 42

Expert Comment

by:frodoman
ID: 16510302
Also make sure you save the report and close it completely.  Now when you open it again, you should see a progress bar with a message "Active-X links updating" (or something similar - don't remember the exact text).
0
 

Author Comment

by:tegronakron
ID: 16510425
I saved the report, and closed it, opened it again, and didn't get the "Active X Links updating" message and it still is an icon.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 16511567
I assume you also tried adding a new one and insure the display as icon wasn't checked?

I've tried to replicate the behavior you describe and the only way I can do it is with an invalid image format (e.g.: gif).  Maybe you've got a .bmp format that Crystal doesn't support?  Perhaps try it with a .jpg image instead and see if you have better results?
0
 
LVL 13

Assisted Solution

by:EwaldL
EwaldL earned 1000 total points
ID: 16514167
If the image shows as icon, then you need to configure the relevant ole server. This article explains how (ie install Microsoft Photo Editor). The article is about a slightly different problem, but the same resolution steps apply to you http://support.businessobjects.com/library/kbase/articles/c2006977.asp

Another option to change images on a report in .net would be to
- either upgrade to Crystal Reports XI Developer (not sure if that has been mentioned above?)
- or to pass a dataset to the report which contains the image(s) you want to see
0
 

Author Comment

by:tegronakron
ID: 16524806
Well as the link you posted suggest, I tried to double-click on the icon in the report and it brings up a prompt that says "Do you want to open this file?"  Then if I click ok, it opens Microsoft Office Picture Manger.  Then it displays ok, I do not have Microsoft Photo Editor on my machine currently.  Do you think that would make a difference?  
With regard to your post frodoman, I did at a new one, and made sure the display as icon wasn't checked.  I also tried it with a .jpg that i created in MS Paint.  I am still getting icons.  Is there perhaps a service pack for Crystal to fix this?
I think all I have is the original installed.

0
 
LVL 42

Expert Comment

by:frodoman
ID: 16524928
I'm not aware of a patch that specifically deals with this but certainly it won't hurt you to update - it may have been solved long ago and I just never heard about the problem.  You can get the latest updates here: http://support.businessobjects.com/downloads/updates/service_packs/crystal_reports.asp

0
 
LVL 42

Accepted Solution

by:
frodoman earned 1000 total points
ID: 16524950
>>> Then it displays ok, I do not have Microsoft Photo Editor on my machine currently.  Do you think that would make a difference?  

Sorry, I just re-read what you wrote.  ***YES*** this will make a difference.  From the link that EwaldL posted, you do need an OLE object server that can translate image types.  Doesn't have to be MS Photo Editor, it could be Photoshop or other image editing software as well.

frodoman
0
 

Author Comment

by:tegronakron
ID: 16525704
I found an article about how MS Photo Editor is removed when you install Office 2003 and replaces by Microsoft Office Picture Manager.  So I removed Microsoft Office Picture Manager by running Office 2003 setup and set Microsoft Picture Manager to be Not Installed.  When I re-run the report now, it shows the picture.  This only works for bitmaps, my jpg image still gave me the icon, but that is ok.  The client may not have Office installed so therefore this might not be an issue.  Thanks for the solution!
0
 
LVL 42

Expert Comment

by:frodoman
ID: 16525778
Glad to assist.  

You might want to look around for OLE object servers - I don't know but I suspect that there may be one you can distribute in case your clients don't have Office or possibly even a Windows component that can be installed.  Good luck!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question