0
votes

When using the Crystal Reports ActiveX viewer (with Delphi XE3 in this case), how do you specify the report file to view ??? There is no property in the CR control in which to enter the name or location of the report.

2

2 Answers

0
votes

The Crystal Reports XI ActiveX viewer is not functional. I guess you're trying to use it to make Crystal Reports work with Delphi. It doesn't. It doesn't even work anywhere else. The latest install of Crystal Reports XI doesn't even ship with the ActiveX version, only the .net version.

There are still installers floating around (or on your local network) that include this ActiveX control but the CR XI forum discussions (Crystal Reports now managed by SAP) point to the ActiveX control being deprecated almost a decade ago, non-functional for the last 5 years, and removed completely from the latest installers, over 2 years ago.

0
votes

The ActiveXViewer does work with Delphi XE3. Here's a sample:

unit crystalreports;

interface

uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,       
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls,      
ActiveX, ComObj, Data.DB, Data.Win.ADODB, CrystalActiveXReportViewerLib11_TLB;

type 
TReportForm = class(TForm)
 CrystalReportsViewer: TCrystalActiveXReportViewer; 
 PreviewButton: TButton; 
 procedure PreviewButtonClick(Sender: TObject); 
 private { Private declarations } 
 public { Public declarations } 
 end;

 var ReportForm : TReportForm;

 implementation

 {$R *.dfm}

 procedure TReportForm.PreviewButtonClick(Sender: TObject); 
    var CReport, CRApp : variant; 
    i :integer; 

begin 
CRApp := CreateOleObject('CrystalRuntime.Application'); 
CReport := CRApp.OpenReport('C:\Crystal Reports Test\companydatasheet.rpt',0 ); 
for i := 1 to CReport.Database.Tables.Count do 
begin 
    CReport.Database.Tables[1].ConnectionProperties.Item['User ID'] := 'sa';  
    CReport.Database.Tables[1].ConnectionProperties.Item['Password'] := 'secret'; 
end; 
CReport.RecordSelectionFormula := '{member.member_no} = "101"';        
CrystalReportsViewer.Align := alClient; 
CrystalReportsViewer.ReportSource := CReport; 
ReportForm.WindowState := wsMaximized; 
PreviewButton.Visible := False; 
CrystalReportsViewer.ViewReport; 
CrystalReportsViewer.Show; PreviewButton.Visible := True; 
end;

end.