sivaman
asked on
Upgrade from Crystal Report 8 to Crystal Report 2008
We are trying to upgrade an windows Service written in VS 2003 and Crystal Reports 8 to VS 2010 and Crystal Reports 2008. VS 2003 references "CRAXDRT.dll". I was successfully able to convert the solution to VS2010. After running the Windows Service and trying to print the report, the code blows up at the following line.
mobjInserts(intI) = New Report
and gives an error message
"Retrieving the COM class factory for component with CLSID {B4741FD0-45A6-11D1-ABEC-0 0A0C9274B9 1} failed due to the following error: 80040154.
The Report is a public class which has CRAXDRT.Application and CRAXDRT.Report. Below is the code snippet.
Public Class Report
Implements IDisposable
Private mApp As New CRAXDRT.Application
<CLSCompliant(False)> _
Public mReport As CRAXDRT.Report
Private mstrDefaultQueue As String
Private mReportType As rptReportType
Private mstrCompDisclaimers() As String
Private mstrCompDisclaimersGroup2( ) As String
Private mstrTrayDisclaimers(,) As String
Private mstrBoldTrayDisclaimers(,) As String
Private strClassMethodError As String
Dim disposed As Boolean
I would like to view the reports in Crystal Reports 2008 launched from VS 2010. Please let me a solution to handle this.
mobjInserts(intI) = New Report
and gives an error message
"Retrieving the COM class factory for component with CLSID {B4741FD0-45A6-11D1-ABEC-0
The Report is a public class which has CRAXDRT.Application and CRAXDRT.Report. Below is the code snippet.
Public Class Report
Implements IDisposable
Private mApp As New CRAXDRT.Application
<CLSCompliant(False)> _
Public mReport As CRAXDRT.Report
Private mstrDefaultQueue As String
Private mReportType As rptReportType
Private mstrCompDisclaimers() As String
Private mstrCompDisclaimersGroup2(
Private mstrTrayDisclaimers(,) As String
Private mstrBoldTrayDisclaimers(,)
Private strClassMethodError As String
Dim disposed As Boolean
I would like to view the reports in Crystal Reports 2008 launched from VS 2010. Please let me a solution to handle this.
ASKER
The above comment was useful. I'm in the process of following up the document and converting the code..I will let you know if I come across any hassle. Once again thanks for the comment.
ASKER
Hi mlmcc,
Im trying to find a replacement for AddPictureObject which is used in RDC to Crystal Reports.
mReport is the CRAXDRT.Report object.
mReport.Sections(ReportSec tion).AddP ictureObje ct(strImag ePath, XCoordinate, YCoordinate)
Could you please give me an replacement for AddPictureObject ?
Thanks
Siva Manickam
Im trying to find a replacement for AddPictureObject which is used in RDC to Crystal Reports.
mReport is the CRAXDRT.Report object.
mReport.Sections(ReportSec
Could you please give me an replacement for AddPictureObject ?
Thanks
Siva Manickam
CR XI doesn't support that.
You can use the filepath in the OLE Object rather than adding a picture.
I don't know what the replacement would be but look at the OLE object properties.
mlmcc
You can use the filepath in the OLE Object rather than adding a picture.
I don't know what the replacement would be but look at the OLE object properties.
mlmcc
ASKER
Im using Crystal Reports 2008. How can we add the picture from a file path using crystal reports 2008?
CR XI directions
(CR2008 should be similar)
Insert a picture into the report
Pick any picture
Right click it
Click FORMAT GRAPHIC
Click the HYPERLINK Tab
Click A FILE
Browse to the picture you want.
You can use the formula button to choose different files based on the record
You can also store the filepath in the database and use it directly on the report
mlmcc
(CR2008 should be similar)
Insert a picture into the report
Pick any picture
Right click it
Click FORMAT GRAPHIC
Click the HYPERLINK Tab
Click A FILE
Browse to the picture you want.
You can use the formula button to choose different files based on the record
You can also store the filepath in the database and use it directly on the report
mlmcc
ASKER
Thanks mlmcc. But I need to dynamically load the picture from a Image path. The Image path and co-ordiantes are given at run time . I need to add the picture programmatically using VB.net vs 2010.
ASKER
Dear mlmcc,
To be more precise, I need to create a place holder in crystal reports which can dynamically load images from a file path based on a specific conditions..I would appreciate if you can guide me in the right direction..
Thanks
Siva Manickam
To be more precise, I need to create a place holder in crystal reports which can dynamically load images from a file path based on a specific conditions..I would appreciate if you can guide me in the right direction..
Thanks
Siva Manickam
WHere is the file path stored?
Can you build a formula like
If {CompanyName} = "AAA" then
"c:\Pictures\AAALogo.jpg"
Else etc
mlmcc
Can you build a formula like
If {CompanyName} = "AAA" then
"c:\Pictures\AAALogo.jpg"
Else etc
mlmcc
ASKER
The image path is passed from the .net code..Im new to crystal reports 2008. I
I have added an jpg image, right click, format graphic --> picture tab --> Graphic Location --> added a formula "imglocation".
Now I need to access to variable imglocation from .net, and set the image path. So every time I set a new image path, the picture changes dynamically. In my case all pictures are stored in a network drive, say ex \\is11740\outbound\VectorI magesBard.
Since, Im new to crystal reports, I would appreciate if you can guide me on how to access the variable and send the image path.\
Thanks
Siva
I have added an jpg image, right click, format graphic --> picture tab --> Graphic Location --> added a formula "imglocation".
Now I need to access to variable imglocation from .net, and set the image path. So every time I set a new image path, the picture changes dynamically. In my case all pictures are stored in a network drive, say ex \\is11740\outbound\VectorI
Since, Im new to crystal reports, I would appreciate if you can guide me on how to access the variable and send the image path.\
Thanks
Siva
What is the formula imglocation?
You can pass the image path as a parameter to the report.
See this code
http://www.thescarms.com/dotnet/CrystalParms.aspx
mlmcc
You can pass the image path as a parameter to the report.
See this code
http://www.thescarms.com/dotnet/CrystalParms.aspx
mlmcc
ASKER
In graphic image location , i have added a variable "imglocation". Please see attached the screen shot of what Im doing.. Crystal-Reports-2008.docx .
Please let me know if Im proceeding in the right direction..
Please let me know if Im proceeding in the right direction..
How are you passing the value into the report?
The report doesn't know about VB variables.
Add a parameter to the report
Change your code to {?YourParameter}
mlmcc
The report doesn't know about VB variables.
Add a parameter to the report
Change your code to {?YourParameter}
mlmcc
ASKER
Im new to Crystal Reports..Im currently using your program to see if I can dynamically change images..Please find attached the sample code..Im also facing another problem..Im using VS 2010 and crystal reports 2008. Im getting the below warning too..
The referenced assembly "CrystalDecisions.CrystalR eports.Eng ine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521 e1304, processorArchitecture=MSIL " could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d 50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4. 0,Profile= Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
I followed the link which you gave me..
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0eb394f-931e-2b10-3b82-9413bfc3f457
Now Im trying a sample application for loading the images dynamically..I have attached the code snippet..Im getting errors like " Type ReportDocument is not defined".
should I have to change the target framework to Version 2.0?
Thanks
Siva
The referenced assembly "CrystalDecisions.CrystalR
I followed the link which you gave me..
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0eb394f-931e-2b10-3b82-9413bfc3f457
Now Im trying a sample application for loading the images dynamically..I have attached the code snippet..Im getting errors like " Type ReportDocument is not defined".
should I have to change the target framework to Version 2.0?
Thanks
Siva
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Load the selected report file.
'
Dim CR As ReportDocument
CR.Load("C:\Import Print\ImportPrint\bin\Templates\Bard\TestReport.rpt")
'
' Declare the parameter related objects.
'
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer
'
' Get the report's parameters collection.
'
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
'
' Set the first parameter
' - Get the parameter, tell it to use the current values vs default value.
' - Tell it the parameter contains 1 discrete value vs multiple values.
' - Set the parameter's value.
' - Add it and apply it.
' - Repeat these statements for each parameter.
'
crParameterFieldLocation = crParameterFieldDefinitions.Item("imglocation")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "\\is11740\outbound\Test\Final JPG\logo\small\\\is11740\outbound\Test\Final JPG\logo\small\per-q-cath-midline.jpg"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
'
' Set the Crytal Report Viewer control's source to the report document.
'
CrystalReportViewer.ReportSource = CR
End Sub
End Class
Build-Error.docx
Is the parameter named imglocation?
If so then use this for the formula
{?imglocation}
mlmcc
If so then use this for the formula
{?imglocation}
mlmcc
ASKER
Dear mlcc,
Please ignore the previous comment, when I removed the
<TargetFrameworkProfile>Cl ient</Targ etFramewor kProfile> from project file the error disapppeared..
You are right..Im trying to add a parameter in report and trying to pass the value to the report..
Please ignore the previous comment, when I removed the
<TargetFrameworkProfile>Cl
You are right..Im trying to add a parameter in report and trying to pass the value to the report..
Is it working?
mlmcc
mlmcc
ASKER
Im almost there..Im trying to View the report but the report is not showing when I use CrystalReportViewer.Report Source.
Please find the code below..Am I missing something??
Please find the code below..Am I missing something??
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Load the selected report file.
'
Dim CR As New ReportDocument
CR.Load("C:\Import Print\ImportPrint\bin\Templates\Bard\TestReport.rpt")
'
' Declare the parameter related objects.
'
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim CrystalReportViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer
'
' Get the report's parameters collection.
'
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
'
' Set the first parameter
' - Get the parameter, tell it to use the current values vs default value.
' - Tell it the parameter contains 1 discrete value vs multiple values.
' - Set the parameter's value.
' - Add it and apply it.
' - Repeat these statements for each parameter.
'
crParameterFieldLocation = crParameterFieldDefinitions.Item("imgLocation")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "\\is11740\outbound\Test\Final JPG\logo\small\\\is11740\outbound\Test\Final JPG\logo\small\per-q-cath-midline.jpg"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
'
' Set the Crytal Report Viewer control's source to the report document.
'
CrystalReportViewer.ReportSource = CR
CrystalReportViewer.Show()
'AxCrystalActiveXReportViewer1.ReportSource = CR
'AxCrystalActiveXReportViewer1.Show()
End Sub
End Class
ASKER
I also tried adding Crystal ActiveX Report Viewer Control 12 to the form and tried to bind the report source , it still dint work either..
It throwed me an error message attached in the screen shot.. crystal-Report-Viewer-Error.docx
It throwed me an error message attached in the screen shot.. crystal-Report-Viewer-Error.docx
ASKER
Dear mlcc,
Im able to view the reports in Crystal Report Viewer, but the image file is not changing , though I pass in the parameter value with a different path..Please find the code attached..
Below is the line where Im changing the image file path.
crParameterDiscreteValue.V alue = "\\is11740\outbound\Test\F inal JPG\logo\small\\\is11740\o utbound\Te st\Final JPG\logo\small\power-picc- sv.jpg"
Am I missing something here,.
Im able to view the reports in Crystal Report Viewer, but the image file is not changing , though I pass in the parameter value with a different path..Please find the code attached..
Below is the line where Im changing the image file path.
crParameterDiscreteValue.V
Am I missing something here,.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Load the selected report file.
'
Dim CR As New ReportDocument
CR.Load("C:\Import Print\ImportPrint\bin\Templates\Bard\TestReport.rpt")
'
' Declare the parameter related objects.
'
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
'Dim CrystalReportViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer
'
' Get the report's parameters collection.
'
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
'
' Set the first parameter
' - Get the parameter, tell it to use the current values vs default value.
' - Tell it the parameter contains 1 discrete value vs multiple values.
' - Set the parameter's value.
' - Add it and apply it.
' - Repeat these statements for each parameter.
'
crParameterFieldLocation = crParameterFieldDefinitions.Item("imgLocation")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "\\is11740\outbound\Test\Final JPG\logo\small\\\is11740\outbound\Test\Final JPG\logo\small\power-picc-sv.jpg"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
'
' Set the Crytal Report Viewer control's source to the report document.
'
'CrystalReportViewer.ReportSource = CR
'CrystalReportViewer.Show()
CrystalReportViewer1.ReportSource = CR
CrystalReportViewer1.Show()
End Sub
End Class
ASKER
Dear mlcc,
I got this working..now im dynamically changing the text object.. Thanks for your help..
I got this working..now im dynamically changing the text object.. Thanks for your help..
ASKER
Dear mlmcc,
Im trying to convert vs2003 to vs2010 and crystal reports 4.0 to crystal reports 2008. The older code had the line
mReport.Sections("Header1" ).ReportOb jects("RUN WITHOUT"). SetText(st rRunWithou tText)
and I converted this line of code to
Dim RUNWITHOUT As CrystalDecisions.CrystalRe ports.Engi ne.TextObj ect
RUNWITHOUT = Report.ReportDefinition.Se ctions("He ader1").Re portObject s("RUNWITH OUT") RUNWITHOUT.Text = strRunWithoutText
Im getting an error "Value does not fall within the expected range " in the line RUNWITHOUT = Report.ReportDefinition.Se ctions("He ader1").Re portObject s("RUNWITH OUT") .
I'm thinking its not able to find "Header1" section in the report..was wondering if there is an way to find this out..
Im trying to convert vs2003 to vs2010 and crystal reports 4.0 to crystal reports 2008. The older code had the line
mReport.Sections("Header1"
and I converted this line of code to
Dim RUNWITHOUT As CrystalDecisions.CrystalRe
RUNWITHOUT = Report.ReportDefinition.Se
Im getting an error "Value does not fall within the expected range " in the line RUNWITHOUT = Report.ReportDefinition.Se
I'm thinking its not able to find "Header1" section in the report..was wondering if there is an way to find this out..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot mlmcc
This paper should help
Migrating Applications From the RDC to the Crystal Reports XI .NET Assemblies
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0eb394f-931e-2b10-3b82-9413bfc3f457
mlmcc