Print Page | Close Window

Dinamic Images in Crystal reports

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4883
Printed Date: 04 May 2024 at 6:52am


Topic: Dinamic Images in Crystal reports
Posted By: Tiago_BB
Subject: Dinamic Images in Crystal reports
Date 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



Replies:
Posted By: Auk_
Date Posted: 27 Nov 2008 at 3:10am
use vs 2005 and you can do it very easily


Posted By: Tiago_BB
Date Posted: 27 Nov 2008 at 3:38am
I'm using vs2003.

Any suggestions?

thanks


Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Tiago_BB
Date Posted: 05 Dec 2008 at 3:40am
But the image is not in the database, but to a local folder in C:


Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Tiago_BB
Date Posted: 05 Dec 2008 at 8:58am
No.
Are images into a file in C:\...\imegam.jpg

Thanks


Posted By: hilfy
Date 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



-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Tiago_BB
Date 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()


Posted By: hilfy
Date 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 - 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Tiago_BB
Date Posted: 05 Dec 2008 at 9:39am
Ok.

Thanks.



Posted By: Tiago_BB
Date Posted: 05 Dec 2008 at 9:43am
I don´t know how to create parameters in Crystal, but I will take a look.

Thanks.


Posted By: Tiago_BB
Date Posted: 05 Dec 2008 at 9:44am
I'm having other problem.
Insert an OLE object of crystal reports, however, would like to know how to assign a specific path to that object.

I'm using vb.net 2003.


Posted By: hilfy
Date Posted: 05 Dec 2008 at 12:30pm
It looks like you can do the same sort of thing with OLE objects as you can with images.  However, you do have to select the type of OLE object at the time that you create the report - you can't create a "generic" OLE object and then, for example, load a Word doc into it sometimes and an Excel spreadsheet into it at other times.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window