动态产生报表,给你一点思路吧:
procedure AddBandView(Left,Top,Width,Height:integer;BandType:TfrBandType;Page: TfrPage);
var
b: TfrBandView;
begin
b := TfrBandView.Create;
b.SetBounds(Left,Top ,width,height);
b.BandType := BandType;
if BandType=btMasterData then
b.DataSet:=mData.Name;
Page.Objects.Add(b);
end;
procedure AddMemoView(Left,Top,Width,Height,FrameTyp,Alignment:integer;Memo,Cap:String;Page: TfrPage);
var
v,v1:TfrMemoView;
begin
v := TfrMemoView.Create;
// 明细
v.SetBounds(Left + frRepMarginLeft ,200 ,width,DetailHgt);
v.Memo.Add(Memo);
v.FrameTyp:=FrameTyp;
v.Alignment:=Alignment;
Page.Objects.Add(v);
v1 := TfrMemoView.Create;
//标题
v1.SetBounds(Left + frRepMarginLeft ,140 ,width,CapHgt);
v1.Memo.Add(Cap);
v1.FrameTyp:=FrameTyp;
v1.Alignment:=2;
v1.Font.Style:=[fsBold];
Page.Objects.Add(v1);
end;
procedure AddMemoView1(Left,Top,Width,Height,FrameTyp,Alignment,FontSize:integer;FontStyle:TFontStyles;
Cap:String;
Page: TfrPage);
//增加一个Memo
var
v1:TfrMemoView;
begin
v1 := TfrMemoView.Create;
// create data field
v1.SetBounds(Left + frRepMarginLeft ,Top ,width,height );
v1.Memo.Add(Cap);
v1.FrameTyp:=FrameTyp;
v1.Alignment:=Alignment;
v1.Font.Size:=FontSize;
v1.Font.Style:=FontStyle;
//v1.BandAlign:=baRest;
Page.Objects.Add(v1);
end;
procedure NewPage(var frReport:array of TfrReport;var Page:TfrPage;var iPageWidth,iCurLeft,iRepCnt:integer);
var
i:integer;
begin
frReport[iRepCnt]:=TfrReport.Create(fMain);
//frReport[iRepCnt].LoadFromFile('asd.frf');
frReport[iRepCnt].Pages.Add;
Page := frReport[iRepCnt].Pages[0];
Page.ChangePaper($100, frRepPageWidth, frRepPageHeight ,$ffff,poPortrait);
//$100 自定义
Page.pgMargins.Left := frRepMarginLeft;
Page.pgMargins.Top:=frRepMarginTop;
Page.pgMargins.Right:=frRepMarginRight;
Page.pgMargins.Bottom:=frRepMarginBottom;
AddBandView(0,20 ,0,20 ,btReportTitle ,Page);
//添加报表头
。。。。。