Author |
Message |
Tiago_BB
Newbie
Joined: 26 Nov 2008
Location: Brazil
Online Status: Offline
Posts: 17
|
Topic: Dinamic Images in Crystal reports Posted: 26 Nov 2008 at 9:09am |
I'm having a problem!
I am creating a report of recipes, which for each recipe has a related image, the image is not in the database, but to a local folder in C:
I insert a Picture in Crystal Reports in vb.net 2003, but want to specify code via the path on which is the Picture.
In the code in vb I just get the image name. ImageURL = "path" ... Already in crystal tried the following:
DirectCast (Rel.Section6.ReportObjects.Item ( "Picture11"), AppDomain.CurrentDomain.BaseDirectory & = "Images / SemFoto.jpg"
But the conversion of the following error in my line:
Specified cast is not valid.
We also tried to solve my problem inserting an image in my field of type binary64bits dataset, then I created a new instance of my dataset, but has a property called Relatório.Setdatasource (Dataset) that the image is but ... that property looks just like a switch, if I pass that my dataset, the image appears, but does not appear the data of revenue, and if I pass my DataTable, which is powered with a bank in select SQL, the data appears, however , The image does not.
Have you tried everything, or almost everything.
I need to finalize this project as soon appreciate that.
Thank you all
|
IP Logged |
|
Auk_
Newbie
Joined: 27 Nov 2008
Location: Bangladesh
Online Status: Offline
Posts: 5
|
Posted: 27 Nov 2008 at 3:10am |
use vs 2005 and you can do it very easily
|
IP Logged |
|
Tiago_BB
Newbie
Joined: 26 Nov 2008
Location: Brazil
Online Status: Offline
Posts: 17
|
Posted: 27 Nov 2008 at 3:38am |
I'm using vs2003.
Any suggestions?
thanks
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 02 Dec 2008 at 11:49am |
I don't know if this will work in the version of Crystal that came with VS 2003, but it's worth a try. Assuming that the image location is stored in your database, do the following:
- Right-click on the image object and select Format Graphic.
- Go to the Picture tab.
- Click on the "Graphic Location" button.
- In the Formula editor that appears, put the field that contains the path and file name of the image. Save and Close.
- Click on OK in the Format editor.
-Dell
|
|
IP Logged |
|
Tiago_BB
Newbie
Joined: 26 Nov 2008
Location: Brazil
Online Status: Offline
Posts: 17
|
Posted: 05 Dec 2008 at 3:40am |
But the image is not in the database, but to a local folder in C:
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 05 Dec 2008 at 6:56am |
Are the path and filename of the image in the database? That's what my proposed solution uses, not the image itself.
-Dell
|
|
IP Logged |
|
Tiago_BB
Newbie
Joined: 26 Nov 2008
Location: Brazil
Online Status: Offline
Posts: 17
|
Posted: 05 Dec 2008 at 8:58am |
No.
Are images into a file in C:\...\imegam.jpg
Thanks
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 05 Dec 2008 at 9:01am |
How do you know what the file name is for any given recipe?
You could also pass the filepath and name into the report as a parameter and use the technique above to set the image - put the parameter into the formula editor instead of a field.
-Dell
|
|
IP Logged |
|
Tiago_BB
Newbie
Joined: 26 Nov 2008
Location: Brazil
Online Status: Offline
Posts: 17
|
Posted: 05 Dec 2008 at 9:08am |
My code is:
Dim dt As New DataTable
Dim i As Integer
dt = Session.Item("dtRelatorio_028")
Me.crvRelReceitas.ReportSource = Rel
Me.crvRelReceitas.DisplayGroupTree = False
Me.crvRelReceitas.DisplayToolbar = True
Me.crvRelReceitas.BorderColor = Color.Black
Me.crvRelReceitas.BorderStyle = BorderStyle.Solid
Me.crvRelReceitas.DataBind()
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
|
Posted: 05 Dec 2008 at 9:17am |
Do you know how to create parameters in Crystal? You then will have to set the parameter value for the report prior to setting the .ReportSource property of the viewer.
I don't do VB, so I can't give you a specific example for how to set the parameter here. But you can look at sample code in the Developer Libary. Go to http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm and click on "Crystal Reports .NET SDK". Then click on ".NET Developer Guide and API Reference" and "Tutorials and Sample Code".
-Dell
|
|
IP Logged |
|
|