Did this article resolve your question/issue?



How to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file

« Go Back


TitleHow to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file
URL Name000056268
Article Number000142299
EnvironmentProduct: OpenEdge
Version: 11.4
OS: Windows
Question/Problem Description
How to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file.

How to extract the parameters from a .Net Crystal decisions report and use them to export the Crystal report to a .pdf file.
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Use the parameter value name in order to retrieve the discrete parameter value:
DEFINE VARIABLE clsParameterDiscreteValue    AS CLASS  CrystalDecisions.Shared.ParameterDiscreteValue       NO-UNDO.
DEFINE VARIABLE ParamFields    AS CLASS                  CrystalDecisions.Shared.ParameterFields        NO-UNDO.  
DEFINE VARIABLE ParamField      AS CLASS                  CrystalDecisions.Shared.ParameterField         NO-UNDO.   
DEFINE VARIABLE ParamValues   AS CLASS                  CrystalDecisions.Shared.ParameterValues      NO-UNDO.
DEFINE VARIABLE ParamValue     AS CLASS                  CrystalDecisions.Shared.ParameterValue       NO-UNDO. 
DEFINE VARIABLE iParameters      AS INTEGER              EXTENT 2 NO-UNDO.
paramFields = crystalReportViewer1:ParameterFieldInfo.
paramField = paramFields:Item[crwReport:DataDefinition:ParameterFields:Item[i]:Name].                               
paramValues = paramField:CurrentValues.
paramValue = paramValues:Item[0].                
clsParameterDiscreteValue    = CAST(paramValue, CrystalDecisions.Shared.ParameterDiscreteValue).
iParameters[i + 1] = clsParameterDiscreteValue:value.

Use the ExportToDisk method to export the crystal report to a .pdf file.  For example:
crwReport:ExportToDisk(CrystalDecisions.Shared.ExportFormatType:PortableDocFormat, "Salesrep.pdf").

 For the complete code, see the attached example CrystalReportDotNet.p.
To run the attached example code:

1.  Ensure that there is a version of the Crystal Reports runtime engine installed on the machine.  The assemblies.xml file references Crystal Reports version 13.0.2000.0, and this can be obtained from the version released for "Crystal Reports for Visual Studio 2010 Production Release".  Download and install the 32-bit or 64-bit redistributable installation depending on whether the OpenEdge executable is 32-bit or 64-bit.  If other versions of the runtime are required then please contact SAP.
2.  Unzip the zip file contents to the OpenEdge 11.4 working directory.
3.  Start an 11.4 proenv session. 
In the proenv session start the sports2000 database with: 
proserve sports2000 -H localhost -S 9876 -N TCP 
5.  Start the session to run the code with: 
prowin.exe -p CrystalReportDotNet.p -U pub -P pub 

The code was developed using 11.4 32-bit, but will also run correctly with 11.4 64-bit and 11.5 32-bit provided the correct version of the Crystal runtime is installed.
Last Modified Date1/21/2015 12:21 PM
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.