to: xiaoyebing(深蓝大盗) 你可能没有把类型库倒进去,除了要到控件外,还有把类型库倒进去,但进去之后你会看见一个TApplication,还有TReport等 我是这样写的 if(self.OpenDialog1.Execute) then begin self.Report1.ConnectTo( self.Application1.OpenReport(self.OpenDialog1.FileName)); //self.Report1.Database.LogOnServer('chy',); self.CRDesignerCtrl.ReportObject:=self.Report1.DefaultInterface; self.CRViewer91.ReportSource:=self.Report1.DefaultInterface;end; 但是这样就不行,8.5是可以的,我以前用过 self.Report1.ConnectTo( self.Application1.NewReport );还有,经过设计器修改,viewreport后关闭程序会有异常,不知怎么回事,谁解决了告诉我一声阿…,谢谢 没有办法,我只好改道用Vcl了,可是vcl不带设计器,唉:(
to huntgf(huntgf): 您说要把类型库导入? 我已经把ActiveX控件导入了阿,在ActiveX面板就可以看到CrystalReport和CRViewer还有CRDesigner了阿。这还需要导入类型库吗?如果要Import Type Library的话,那要导入哪一些呢,我看好像有重复的类名一样阿,就连TReport就有好几个,是否版本的缘故,亦或用处不一样呢,敬请指点。
Step 1: Creating the user interface (Microsoft Visual Basic) To return to the introduction, go to Creating a Microsoft Visual Basic sample application with the Embeddable Designer.In this step, you will add the references, components, forms, and controls for the application.Create a new Standard EXE project. Add the following components to the project: Crystal Reports Viewer Control. Embeddable Crystal Reports 9 Designer Control. Microsoft Common Dialog 6.0. Microsoft Tabbed Dialog Control 6.0 (Sp4). Add the following reference to the project: Crystal Reports 9 ActiveX Designer Design and Runtime Library. Note: See Programming the Crystal Report Viewers for more information.Add the following controls from the Toolbox to the form: Three CommandButton controls. Common Dialog (Microsoft Common Dialog Control 6.0). SSTab1 (Microsoft Tabbed Dialog Control 6.0 (SP4)). CRDesignerCtrl (Embeddable Crystal Reports 9 Designer Control). CRViewer (Crystal Report Viewer Control).倒入的就是 Crystal Reports 9 ActiveX Designer Design and Runtime Library. 倒入的时候Tdatabase会跟已有的类重名,在下面改一下就行了
如果用VCL,安装的时候需要叙则拷贝文件,吧delphi6的拷出来,然后编译,编译的时候会有错误,你改一下就行了,好像是把那个编译指令加上,具体忘了。不行再问我。
在源代码里加上:
{$DEF CR_6UP}(如果记错了别骂我),如果还有错那就自己该了,我觉得看看他的代码也不错vcl版的不支持设计器,真是遗憾
我用ActiveX版的,总出现异常,不知你们能不能用?
我的Cr是9。2中文版
如执行下面的代码会报一个“不支持此接口”的异常出来
CrystalReport1.ReportFileName := 'F:\Alerting.rpt';
CRViewer1.ReportSource := CrystalReport1;
CRViewer1.ViewReport ;不知各位是怎么解决的呢?
你可能没有把类型库倒进去,除了要到控件外,还有把类型库倒进去,但进去之后你会看见一个TApplication,还有TReport等
我是这样写的
if(self.OpenDialog1.Execute) then
begin
self.Report1.ConnectTo(
self.Application1.OpenReport(self.OpenDialog1.FileName));
//self.Report1.Database.LogOnServer('chy',);
self.CRDesignerCtrl.ReportObject:=self.Report1.DefaultInterface;
self.CRViewer91.ReportSource:=self.Report1.DefaultInterface;end;
但是这样就不行,8.5是可以的,我以前用过
self.Report1.ConnectTo( self.Application1.NewReport );还有,经过设计器修改,viewreport后关闭程序会有异常,不知怎么回事,谁解决了告诉我一声阿…,谢谢
没有办法,我只好改道用Vcl了,可是vcl不带设计器,唉:(
您说要把类型库导入?
我已经把ActiveX控件导入了阿,在ActiveX面板就可以看到CrystalReport和CRViewer还有CRDesigner了阿。这还需要导入类型库吗?如果要Import Type Library的话,那要导入哪一些呢,我看好像有重复的类名一样阿,就连TReport就有好几个,是否版本的缘故,亦或用处不一样呢,敬请指点。
To return to the introduction, go to Creating a Microsoft Visual Basic sample application with the Embeddable Designer.In this step, you will add the references, components, forms, and controls for the application.Create a new Standard EXE project.
Add the following components to the project:
Crystal Reports Viewer Control.
Embeddable Crystal Reports 9 Designer Control.
Microsoft Common Dialog 6.0.
Microsoft Tabbed Dialog Control 6.0 (Sp4).
Add the following reference to the project:
Crystal Reports 9 ActiveX Designer Design and Runtime Library.
Note: See Programming the Crystal Report Viewers for more information.Add the following controls from the Toolbox to the form:
Three CommandButton controls.
Common Dialog (Microsoft Common Dialog Control 6.0).
SSTab1 (Microsoft Tabbed Dialog Control 6.0 (SP4)).
CRDesignerCtrl (Embeddable Crystal Reports 9 Designer Control).
CRViewer (Crystal Report Viewer Control).倒入的就是 Crystal Reports 9 ActiveX Designer Design and Runtime Library.
倒入的时候Tdatabase会跟已有的类重名,在下面改一下就行了
谢谢!
谢谢!
在退出时加上Report1.Disconnect;