I need to communicate with a legacy software wrote in Visual Basic 6 to launch a report (with output in pdf format) from a .net application (using full framework 4.5).I have to istantiate an ActiveX COM Dll that internally use COM Crystal Report 11 runtime objects.
Download File >>> https://tiurll.com/2yVWjy
So I'm hoping someone here could tell me if the default report viewer still exists in CR XI, and if it does, how to invoke it? If it doesn't, is using the report designer component really the only solution to create one?
I'm new in crystal report 11.5, my task is desig time i just create a blank report during runtime programaticaly create Fieldobject,Blob object and so on, i came to know this is the right (Crystal Reports ActiveX Designer Design and Runtime Library 11.5) dll but, i dont know how to write the code. Experts please post simple code, i tried this site but there is no code related my task, experts please help me.
Crystal Reports ActiveX Designer Runtime Library (craxdrt.dll) This library is known as the RDC runtime engine. To access this library in VB, select Project > References and choose Crystal Reports 9 ActiveX Designer Runtime Library. Then you can dimension a variable to access the objects in the object library, shown in Figure 19.4.
Each of these RDC components has a specific task, such as displaying a report, allowing you to view a report, or building a report either at runtime or design time. You can use the RDC components in any combination. Table 19.1 examines some possibilities.
The Report Designer provides Crystal Report functionality. Reports can be modified or designed from scratch in the designer. To access the Crystal menus, right-click the white area to the left of the report in the Report Designer; the menus should be familiar Crystal menus. The toolbar is also similar to the one in Crystal Reports. Reports created in the Report Designer are saved as DSR files. DSR files can be opened only by Visual Basic. You can also save reports created in the Report Designer by clicking the Save To Crystal Report icon on the toolbar (seventh from the left).
Sections and Report Objects Notice back in Figure 19.9 how the report is broken down into sections, and each section contains objects (just like Crystal Reports). Each section has a name: Report Header is called ReportHeaderSection1, Page Header is called PageHeaderSection1, etc. Each of the Report objects in Crystal also has a name. Notice in the Properties window that the PostalCode object is named PostalCode1. Examine the Properties window further and you will see the properties for PostalCode1; for example, it has 2 decimal places, a height of 221 twips, and is indented left 7200 twips. Through the Report Designer you can access all the objects in a Crystal Report. You can also access all the methods and properties of the Report object via code and manipulate the report at runtime instead of at design time.
that code u can use but u need to use crystal report 8 or 8.5. a components will require that is crystal32.ocx. when u installed crystal report it will automatically in ur components list or system32 directory.
ok use it and fun.
bye.
reply me
Thanks for your kind help, I have managed to create the crystal report. Now I want to create an application where different department staff members can choose different catagerories to create their own reports. This way our IT department wouldn't have to create reports for them.
So, I analyzed file access attempts with Process Monitor, and I discovered that I also need following files. By the way, I keep files in @CommonFilesDir&'Crystal Decisions2.0bin, and in @CommonFilesDir&'Crystal Decisions2.0crystalreportviewersActiveXViewer.
I am glad I ran across this. I did have to include WindowsConstants.au3 to make it work, but not big deal. I do have a question I hope someone can answer... My crystal report is prompting for logon credentials. Is there a way to build that into the script?
6 Accessing Data It s almost certain that the data location will change between design and runtime of the report. Using the Database object, DatabaseTables collection, and DatabaseTable object, you can change the report location. The exact steps for accessing data depend on the type of data and the access method, either direct, via ODBC, or through OLE DB. In general, you need to create the Database object, then use the DatabaseTables collection to drill down to each DatabaseTable object. Note that collections in Crystal Reports are 1-based. There will be one DatabaseTable object for each table in the report. The following code shows each of these methods. Direct Data Access Direct data can be used directly from Crystal Reports without going through ODBC or OLEDB. Fox 2x and Access are examples of direct data. In the case of direct data, the location and name of the table may change at runtime. LOCAL odb AS CRAXDRT.Database LOCAL ocdbt AS CRAXDRT.DatabaseTables LOCAL odbt AS CRAXDRT.DatabaseTable ocr = CREATEOBJECT("CrystalRuntime.Application") orpt = ocr.openreport("c:\efox\direct1.rpt")
7 * Create the Database object odb = orpt.database() * Get a references to the DatabaseTables collection ocdbt = odb.tables() * Get a reference to the DatabaseTable object for table 1 odbt = ocdbt.item(1) * Set the location odbt.location = "C:\EFox\Customer.DBF" orpt.printout() ODBC Data Once you ve setup the DSN, connecting to ODBC data is pretty simple. LOCAL odb AS CRAXDRT.Database LOCAL ocdbt AS CRAXDRT.DatabaseTables LOCAL odbt AS CRAXDRT.DatabaseTable ocr = CREATEOBJECT("CrystalRuntime.Application") orpt = ocr.openreport("c:\efox\odbc1.rpt") * Create the Database object odb = orpt.database() * Get a references to the DatabaseTables collection ocdbt = odb.tables() * Get a reference to the DatabaseTable object for table 1 odbt = ocdbt.item(1) * Set the location * This one works for a DSN odbt.setlogoninfo("tazodbcruntime") IF orpt.hassaveddata orpt.discardsaveddata() ENDIF orpt.printout() XML Data Crystal Reports uses the CRXML ODBC driver to connect to XML data. You ll need to setup a DSN for the data access. The following code shows how to access the XML file at runtime.
9 * Create the Database object odb = orpt.database() * Get a references to the DatabaseTables collection ocdbt = odb.tables() * Get a reference to the DatabaseTable object for table 1 odbt = ocdbt.item(1) * Pass the Record Set to Crystal Reports odbt.setdatasource(ors) IF orpt.hassaveddata orpt.discardsaveddata() ENDIF orpt.printout() Parameter Fields Parameter fields are used to pass information from your application to the RDC. One of the most common uses is for providing query or sort information to the report. LOCAL odb AS CRAXDRT.Database LOCAL ocdbt AS CRAXDRT.DatabaseTables LOCAL odbt AS CRAXDRT.DatabaseTable LOCAL ocparm AS CRAXDRT.ParameterFieldDefinitions LOCAL oparm AS CRAXDRT.ParameterFieldDefinition ocr = CREATEOBJECT("CrystalRuntime.Application") orpt = ocr.openreport("c:\efox\parms.rpt") * Create the Database object odb = orpt.database() * Get a references to the DatabaseTables collection ocdbt = odb.tables() * Get a reference to the DatabaseTable object for table 1 odbt = ocdbt.item(1) * This one works for a DSN odbt.setlogoninfo("tazodbcruntime") IF orpt.hassaveddata orpt.discardsaveddata() ENDIF
10 * Get the Special Message Parameter ocparm = orpt.parameterfields() oparm = ocparm.item(1) oparm.setcurrentvalue("this is the runtime special message") orpt.printout() Exporting Reports Exporting a report is done in two steps. In step one, you set the report options. Then, in step two, you actually do the export. The following code will export a report to a Microsoft Excel file: LOCAL oexp AS CRAXDRT.ExportOptions ocr = CREATEOBJECT( CrystalRuntime.Application ) orpt = ocr.openreport( C:\Temp\Taz.RPT ) oexp = orpt.exportoptions() oexp.destinationtype = 1 && credtdiskfile oexp.formattype = 27 && creftexcel70 oexp.diskfilename = "C:\Temp\Taz.XLS" orpt.export(.f.) The False parameter on the Export method tells the RDC to not prompt the user for Export options. Previewing Reports The last major thing that you ll do with the RDC is previewing reports. This is an ActiveX control that you can drop on a VFP form. The Report Viewer allows you to control which options the user has available at runtime. For example, you can set the Visible property of the Export button to prohibit exporting the report. Select the Crystal Report Viewer Control from the Controls tab of the VFP Options dialog. The following form code shows you how to preview a report. In this example, the Report Viewer control has been dropped on the form and named olecrviewer. DEFINE CLASS form1 AS form Caption = "Report Preview" ocrystal =.F. oreport =.F. PROCEDURE Init LPARAMETERS tcreport LOCAL cr AS crviewer.crviewer
13 * Set the location * This one works for a DSN odbt.setlogoninfo("tazodbcruntime") IF orpt.hassaveddata orpt.discardsaveddata() ENDIF orpt.printout() RETURN DEFINE CLASS CrystalEvents AS session OLEPUBLIC IMPLEMENTS IReportEvent IN "CrystalRuntime.Application" orpt = NULL PROCEDURE IReportEvent_NoData(pCancel AS LOGICAL) AS VOID ; HELPSTRING "Fires this event when there is no data" * add user code here PROCEDURE IReportEvent_BeforeFormatPage(PageNumber AS Number) ; AS VOID ; HELPSTRING "Fires this event before formatting a page" * add user code here PROCEDURE IReportEvent_AfterFormatPage(PageNumber AS Number) ; AS VOID ; HELPSTRING "Fires this event after formatting a page" STRTOFILE("AfterFormatPage", "C:\temp\cr.txt") PROCEDURE IReportEvent_FieldMapping(reportFieldArray AS VARIANT, ; databasefieldarray AS VARIANT, usedefault AS LOGICAL) AS VOID ; HELPSTRING "Fires this event if database is changed while " + "verifing database" * add user code here ENDDEFINE Creating Reports The RDC gives you complete control over creating your reports. You can do this either programmatically or use the runtime designer and let users create their own reports. With both of these options, additional licensing is required.
aa06259810