运行时动态向RAVE报表增加一个TEXT对象
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, RpBase, RpSystem, RpDefine,
RpRave,RvCsRpt,RVProj,RVClass,RVCsStd;
type
TForm1 = class(TForm)
RvProject1: TRvProject;
RvSystem1: TRvSystem;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
MyBand: TRaveBand;
MyRegion: TRaveRegion;
MyPage: TRavePage;
MyText: TRaveText;
begin
RvProject1.Open;
With RvProject1.ProjMan do
begin
MyPage := FindRaveComponent('Report1.Page1',nil) as TRavePage;
MyRegion:= FindRaveComponent('Region1',MyPage) as TRaveRegion;
MyBand := FindRaveComponent('Band1',MyRegion) as TRaveBand;
MyText:=TRaveText.Create(Myband);
MyText.Parent:=Mypage;
MyText.Name:=GetUniqueName('Text1',MyPage,false);
MyText.Top:=0.2;
MyText.Left:=0.7;
MyText.Width:=200;
MyText.Height:=200;
MyText.Text:='SCYANGYU@163.COM';
MyText.Font.Size :=20; //设置字体的属性
MyText.Font.Color :=ClRed;
MyText.Font.Name :='隶书';
AddComponent(MyText);
end; { with }
RvProject1.ExecuteReport('Report1');
RvProject1.Close;
end;
end.