如何用delphi 6调用水晶报表9的报表 我安装了水晶报表9,做了一个报表,想在delphi6中调出预览,但不知如何做。 我是第一次使用水晶报表。 请各位兄弟帮助一下我。在此谢过。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先选择 1,project -- import type library 出现一个box 2,在box中 选择 crystal report x activex designer runtime library(x代表你的水晶报表是什么版本的,如8.5,那x就是8.5)3. 点击 Install 按纽 ,然后点击 Into New Package(这里会要求你输入一个路径(如:e:\borland\delphi6\Lib\cradrl.dpk) , 点击 ok就可以了。在确定框中点击 yes,在Delphi 的Activex中就增加了一个application对象。4.把application 拖放到form1中,project 自动生成如下代码:unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs;typeTForm1 = class(TForm)Application1: TApplication;procedure FormCreate(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);beginend;end.添加完apllication后,我们还要再增加一个报表浏览组件crystal Reports viewer control(crviewer.dll)步骤和上面是一样的:首先选择 1,project -- import type library 出现一个box2,在box中 选择 crystal reports viewer control3. 点击 Install 按纽 ,然后点击 Into New Package(这里会要求你输入一个路径(如:e:\borland\delphi6\Lib\crviewer.dpk) , 点击 ok就可以了。在确定框中点击 yes,在Delphi 的Activex中就增加了一个crviewer对象。4.把它添加到form15.在form1中增加一个Button现在就可以在button 的click 事件中写如下代码:procedure TForm1.Button1Click(Sender: TObject);varreport : IReport;begin/我们可以打开一个已经生成的报表,这是动态的,可以在报表制作的时/侯连接好数据库,当然也可以通过在delphi中调用LogonServer/setlogoninfo来动态连接数据库。report := Application1.OpenReport('c:\report1.rpt',crOpenReportByTempCopy);/*The CrOpenReportByDefault constant places a lock on the RPT file preventing it from being accessed by other applications or users. CrOpenReportByTempCopy is often preferred since it opens a temporary copy of the RPT file instead. */crViewer1.ReportSource := Report;crViewer1.ViewReport;end;/这样,我们就成功的调入了一个报表,实现了delphi对外部报表的引用 多谢xie66(小谢),我试过可以了。昨天我们老师还说delphi 6不支持水晶报表9,可我就偏不信,所以就发个贴子问问,没想到这么快就有人帮忙了。哎,老师真是误人子弟呀。 请问在哪里有介绍水晶报表和delphi结合使用的参考资料? 基本上很少,不过电子工业出版社出有两本书不错:水晶报表从入门到精通、水晶报表设计与开发实务,都是以VB为例子的,但水晶报表的内部方法是通用的,你应该可以在DELPHI中找到变通的方法。 1,project -- import type library 出现一个box 2,在box中 选择 crystal report x activex designer runtime library(x代表你的水晶报表是什么版本的,如8.5,那x就是8.5)3. 点击 Install 按纽 为什么我一做到这一步就提示出错"a class named 'TDatabase' already installed"这是怎么回事????? 在目标进程内执行DLL里的函数 哪里有比较全的消息类型介绍? 请问一下,如何打印DBGrid中所有的数据记录? combobox问题 我想实现远程计算机与服务器的通信功能,应该怎么来实现?? 为什么应用程序找不到Midas.dll? 有点着急(在线问) 如何用BDE链接Access数据库(来者有分) 有关在窗体上如何动态生成DBEdit控件,显示数据 一个问题:2个月能把Delphi学成什么样? 水晶报表9.2自己说支持到d6,怎么弄到Delphi7上去呀,高人指点!!! 关于可用分的贴子。
表你的水晶报表是什么版本的,如8.5,那x就是8.5)
3. 点击 Install 按纽 ,然后点击 Into New Package(这里会要求你输入一
个路径(如:e:\borland\delphi6\Lib\cradrl.dpk) , 点击 ok就可以了。在确定框中
点击 yes,在Delphi 的Activex中就增加了一个application对象。
4.把application 拖放到form1中,project 自动生成如下代码:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
Application1: TApplication;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
beginend;end.添加完apllication后,我们还要再增加一个报表浏览组件crystal Reports viewer co
ntrol(crviewer.dll)
步骤和上面是一样的:
首先选择 1,project -- import type library 出现一个box2,在box中 选择 crystal reports viewer control
3. 点击 Install 按纽 ,然后点击 Into New Package(这里会要求你输入一
个路径(如:e:\borland\delphi6\Lib\crviewer.dpk) , 点击 ok就可以了。在确定框
中点击 yes,在
Delphi 的Activex中就增加了一个crviewer对象。
4.把它添加到form1
5.在form1中增加一个Button
现在就可以在button 的click 事件中写如下代码:procedure TForm1.Button1Click(Sender: TObject);
var
report : IReport;
begin
/我们可以打开一个已经生成的报表,这是动态的,可以在报表制作的时
/侯连接好数据库,当然也可以通过在delphi中调用LogonServer
/setlogoninfo来动态连接数据库。
report := Application1.OpenReport('c:\report1.rpt',
crOpenReportByTempCopy);/*The CrOpenReportByDefault constant places a lock o
n the RPT file
preventing it from being accessed by other applications or users.
CrOpenReportByTempCopy is often preferred since it opens a temporary
copy of the RPT file instead. */crViewer1.ReportSource := Report;
crViewer1.ViewReport;
end;
/这样,我们就成功的调入了一个报表,实现了delphi对外部报表的引用
表你的水晶报表是什么版本的,如8.5,那x就是8.5)
3. 点击 Install 按纽 为什么我一做到这一步
就提示出错
"a class named 'TDatabase' already installed"
这是怎么回事?????