fastreport的动态生成问题

blueshu 2003-09-22 09:51:38
1、Demo中的runtime的例子不全,哪位能给个全一点的例子如有
pageheader,pagefooter等等
2、怎么样给TfrBandView的onbeforeprint事件赋事件
就是动态的在程序中写?我没找到这个东东
msn:huhao618@163.com
...全文
93 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzds2000 2003-09-22
  • 打赏
  • 举报
回复
学习,顶。。。
blueshu 2003-09-22
  • 打赏
  • 举报
回复
楼上的怎么联系啊?
blueshu 2003-09-22
  • 打赏
  • 举报
回复
楼上的继续搞定第二个问题啊
WWWWA 2003-09-22
  • 打赏
  • 举报
回复
var
t: TfrbandView;
begin
t := TfrbandView(frReport1.FindObject('masterdata1'));
if t <> nil then begin showmessage('123');
t.Script.Add('memo1.memo:="123"');end;
测试通过
WWWWA 2003-09-22
  • 打赏
  • 举报
回复
第二个问题在DEMO中没有找到答案
ujjcel 2003-09-22
  • 打赏
  • 举报
回复
楼上正是我所想知道的,关注.
zjm107 2003-09-22
  • 打赏
  • 举报
回复
楼上的写的不错,试一试吧
WWWWA 2003-09-22
  • 打赏
  • 举报
回复
var
v: TfrView;
b: TfrBandView;t3:tfrlineview;
Page: TfrPage;t2:tfrpictureview;
t: TfrshapeView;t1:tfrbarcodeview;
begin
frReport1.LoadFromFile('d:\rsc\try.frf');
Page := frReport1.Pages[0];
v := TfrEditControl.Create; // create editbox
v.SetBounds(60, 50, 75, 21);
v.Name := 'Edit1';
Page.Objects.Add(v);

v := TfrButtonControl.Create; // create button
v.SetBounds(60, 100, 75, 25);
TfrButtonControl(v).Button.Caption := 'Test!';
TfrButtonControl(v).Button.Font.Name:='隶书';
TfrButtonControl(v).Button.ModalResult := mrOk;
Page.Objects.Add(v);

v := Tfrcheckboxcontrol.Create; // create editbox
v.SetBounds(60, 150, 115, 21);
v.Name := 'checkbox1';
Tfrcheckboxcontrol(v).CheckBox.Caption:='姓名不同是否翻页?';
Tfrcheckboxcontrol(v).CheckBox.Checked:=true;
Page.Objects.Add(v);

v := Tfrradiobuttoncontrol.Create; // create editbox
v.SetBounds(250, 150, 100, 21);
v.Name := 'ra1';
Tfrradiobuttoncontrol(v).RadioButton.Checked:=true;
Page.Objects.Add(v);

v := Tfrcomboboxcontrol.Create; // create editbox
v.SetBounds(60, 200, 75, 21);
v.Name := 'com1';
Tfrcomboboxcontrol(v).ComboBox.Items.Add('123');
Tfrcomboboxcontrol(v).ComboBox.Items.Add('456');
Tfrcomboboxcontrol(v).ComboBox.Style:=csDropDownList;
Tfrcomboboxcontrol(v).ComboBox.ItemIndex:=0;
Page.Objects.Add(v);

Page := frReport1.Pages[1];
b := TfrBandView.Create; // create Title band
b.SetBounds(0,88,757,20); // position and size in pixels
b.BandType := btReportTitle; // (only Top and Height are significant
Page.Objects.Add(b);
// for the band)
b := TfrBandView.Create; // create Title band
b.SetBounds(0,112,757,20); // position and size in pixels
b.BandType := btpageheader; // (only Top and Height are significant
Page.Objects.Add(b);

v := TfrMemoView.Create; // create memo
v.SetBounds(280, 20, 112, 20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(220,64,96,20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw1');
Page.Objects.Add(v);

v := TfrpictureView.Create; // create memo
v.SetBounds(352,68,96,20);
//v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Name:='zz';
//v.Memo.Add('Your text is: zw1');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(260,88,96,20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw2');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(236, 112, 112, 20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw3');
Page.Objects.Add(v);

v:=tfrshapeview.Create;
v.SetBounds(328,20,96,20);
v.Name:='shape2';
Page.Objects.Add(v);

v:=tfrlineview.Create;
v.SetBounds(200,20,0,20);
v.Name:='line1';
Page.Objects.Add(v);

v:=tfrbarcodeview.Create;
v.SetBounds(444,20,142,20);
v.Name:='barcode1';
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(150, 20, 96, 20);
//v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('[dialogform.query1.sfgz]');
Page.Objects.Add(v);

t1:= TfrbarcodeView(frReport1.FindObject('barcode1'));
if t1<>nil then t1.Memo.clear;t1.Memo.Add('[dialogform.query1.bh]');

t2:= TfrpictureView(frReport1.FindObject('zz'));
if t2<>nil then t2.Picture.LoadFromFile('d:\rsc\normal.ico');

t:= TfrshapeView(frReport1.FindObject('shape2'));
if t<>nil then t.ShapeType:=skDiagonal1;

t3:= TfrlineView(frReport1.FindObject('line1'));
if t3<>nil then t3.FrameWidth:=10;

frReport1.ShowReport;
end;

end.
WWWWA 2003-09-22
  • 打赏
  • 举报
回复
var
v: TfrView;
b: TfrBandView;t3:tfrlineview;
Page: TfrPage;t2:tfrpictureview;
t: TfrshapeView;t1:tfrbarcodeview;
begin
frReport1.LoadFromFile('d:\rsc\try.frf');
Page := frReport1.Pages[0];
v := TfrEditControl.Create; // create editbox
v.SetBounds(60, 50, 75, 21);
v.Name := 'Edit1';
Page.Objects.Add(v);

v := TfrButtonControl.Create; // create button
v.SetBounds(60, 100, 75, 25);
TfrButtonControl(v).Button.Caption := 'Test!';
TfrButtonControl(v).Button.Font.Name:='隶书';
TfrButtonControl(v).Button.ModalResult := mrOk;
Page.Objects.Add(v);

v := Tfrcheckboxcontrol.Create; // create editbox
v.SetBounds(60, 150, 115, 21);
v.Name := 'checkbox1';
Tfrcheckboxcontrol(v).CheckBox.Caption:='姓名不同是否翻页?';
Tfrcheckboxcontrol(v).CheckBox.Checked:=true;
Page.Objects.Add(v);

v := Tfrradiobuttoncontrol.Create; // create editbox
v.SetBounds(250, 150, 100, 21);
v.Name := 'ra1';
Tfrradiobuttoncontrol(v).RadioButton.Checked:=true;
Page.Objects.Add(v);

v := Tfrcomboboxcontrol.Create; // create editbox
v.SetBounds(60, 200, 75, 21);
v.Name := 'com1';
Tfrcomboboxcontrol(v).ComboBox.Items.Add('123');
Tfrcomboboxcontrol(v).ComboBox.Items.Add('456');
Tfrcomboboxcontrol(v).ComboBox.Style:=csDropDownList;
Tfrcomboboxcontrol(v).ComboBox.ItemIndex:=0;
Page.Objects.Add(v);

Page := frReport1.Pages[1];
b := TfrBandView.Create; // create Title band
b.SetBounds(0,88,757,20); // position and size in pixels
b.BandType := btReportTitle; // (only Top and Height are significant
Page.Objects.Add(b);
// for the band)
b := TfrBandView.Create; // create Title band
b.SetBounds(0,112,757,20); // position and size in pixels
b.BandType := btpageheader; // (only Top and Height are significant
Page.Objects.Add(b);

v := TfrMemoView.Create; // create memo
v.SetBounds(280, 20, 112, 20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(220,64,96,20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw1');
Page.Objects.Add(v);

v := TfrpictureView.Create; // create memo
v.SetBounds(352,68,96,20);
//v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Name:='zz';
//v.Memo.Add('Your text is: zw1');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(260,88,96,20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw2');
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(236, 112, 112, 20);
v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('Your text is: zw3');
Page.Objects.Add(v);

v:=tfrshapeview.Create;
v.SetBounds(328,20,96,20);
v.Name:='shape2';
Page.Objects.Add(v);

v:=tfrlineview.Create;
v.SetBounds(200,20,0,20);
v.Name:='line1';
Page.Objects.Add(v);

v:=tfrbarcodeview.Create;
v.SetBounds(444,20,142,20);
v.Name:='barcode1';
Page.Objects.Add(v);

v := TfrMemoView.Create; // create memo
v.SetBounds(150, 20, 96, 20);
//v.BandAlign := baWidth;
v.Prop['Alignment'] := frtaCenter; // another way to access properties
v.Prop['Font.Style'] := 2;
v.Memo.Add('[dialogform.query1.sfgz]');
Page.Objects.Add(v);

t1:= TfrbarcodeView(frReport1.FindObject('barcode1'));
if t1<>nil then t1.Memo.clear;t1.Memo.Add('[dialogform.query1.bh]');

t2:= TfrpictureView(frReport1.FindObject('zz'));
if t2<>nil then t2.Picture.LoadFromFile('d:\rsc\normal.ico');

t:= TfrshapeView(frReport1.FindObject('shape2'));
if t<>nil then t.ShapeType:=skDiagonal1;

t3:= TfrlineView(frReport1.FindObject('line1'));
if t3<>nil then t3.FrameWidth:=10;

frReport1.ShowReport;
end;

end.

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧