网上文摘 小说 Flash游戏 最近更新 下载排行 资源分类 下载指南
经典编程资源 精彩不容错过
设为首页
加入收藏
联系我们
当前位置:Delphi园地技巧文章控件使用 → 在Rave报表中打印TeeChart图表
在Rave报表中打印TeeChart图表
日期:2004年12月10日 作者:SCYANGYU 人气: 查看:[大字体 中字体 小字体]
(1)  在Delphi 7开始一个新项目。

(2)  放置一个TChart部件在窗体上,增加一个TPieSeries系列。

(3)  增加如下的FormCreate过程。

procedure TForm1.FormCreate(Sender: TObject);
begin
    Series1.FillSamplevalues(5);
end;

(4)  放置一个TRvCustomConnection部件在窗体上。完成TRvCustomConnection部件的两个
事件过程如下:

procedure TForm1.RvCustomConnection1GetRow(
  Connection: TRvCustomConnection);
begin
    // Chart is the name of the TChart component you are wanting to print
    WriteChartData(Connection, Chart1);
end;

procedure TForm1.RvCustomConnection1GetCols(
  Connection: TRvCustomConnection);
begin
    with Connection do
    begin
        // PieChart is the name of the DataField that you will use in Rave
        WriteField('PieChart', dtGraphic, 30, '', '');
    end; { with }
end;

(5) 为了让Rave可视报表编辑器能够识别TRvCustomConnection部件,请直接在Delphi 7.0
的IDE中运行应用程序。

(6) 打开Rave可视报表编辑器,创建一个新的DataView,使之与TRvCustomConnection部件
连接。

(7) 放置一个metafile部件到你需要的页面,设定metafile部件的DataView和DataField属
性,使之与前面的DataView进行挂接。

(8) 保存报表项目文件后,退出Rave可视报表编辑器。

(9) 关闭正在运行的应用程序。

(10) 回到Delphi 7.0的IDE环境,增加TRvProject和TRvSystem部件,并把两者挂接。设定
TRvProject的ProjectFile属性为前面保存的Rave报表项目文件。

(11) 增加一个按钮,使之调用 RvProject1.execute过程。

(12) 至此,在Rave报表中就可以打印TeeChart图表了!



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RpDefine, RpCon, RpBase, RpSystem, RpRave, TeEngine, Series,
  ExtCtrls, TeeProcs, Chart,RpTChart, StdCtrls;

type
  TForm1 = class(TForm)
    RvCustomConnection1: TRvCustomConnection;
    RvProject1: TRvProject;
    RvSystem1: TRvSystem;
    Chart1: TChart;
    Series1: TPieSeries;
    Button1: TButton;
    procedure RvCustomConnection1GetRow(Connection: TRvCustomConnection);
    procedure RvCustomConnection1GetCols(Connection: TRvCustomConnection);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
    Series1.FillSamplevalues(5);
end;

procedure TForm1.RvCustomConnection1GetRow(
  Connection: TRvCustomConnection);
begin
    // Chart is the name of the TChart component you are wanting to print
    WriteChartData(Connection, Chart1);
end;

procedure TForm1.RvCustomConnection1GetCols(
  Connection: TRvCustomConnection);
begin
    with Connection do
    begin
        // PieChart is the name of the DataField that you will use in Rave
        WriteField('PieChart', dtGraphic, 30, '', '');
    end; { with }
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
    RvProject1.execute;
end;

end.

(出处:www)

相关文章:
·Rave Reports初步入门
·Rave结构
·Rave Reports概述
·Rave Reports初步入门
·Rave报表介绍之二: 可视报表设计器
·Rave结构
·RAVE中Band的BandStyle属性设定方法
·RAVE中TRvCustomConnection组件介绍
·RAVE中Rendering组件介绍
·RAVE中TRvNDRWriter组件介绍
 → 特别推荐
 → 热点TOP10
关于我们 | 广告服务 | 发布资源 | 联系站长 Copyright © 2002-2006 Delphi园地 All Rights Reserved