孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

var
  GPage,GIndex,FGIndex:integer;
  PageList:array of integer;
  PageLine: integer;      
  PageMaxRow: integer=28;         
 
procedure PageFooter1OnBeforePrint(Sender: TfrxComponent);
begin
  GPage := GPage + 1;
end;

procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
  GPage :=1;                                       
end;

procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
var
  i: integer;   
begin
  if Engine.FinalPass then  //二次遍历时增加分组索引
    FGIndex := FGIndex + 1
  else
  begin
    setLength(PageList,GIndex + 1);                                                                   
    PageList[GIndex] := GPage; //存放分组的总页数         
    GIndex := GIndex + 1;
  end;
  GPage := 0;

  i := iif(PageLine=0, PageMaxRow, PageLine);
  child1.visible := True;       
  while i < PageMaxRow do
  begin
    i := i + 1;
    Engine.ShowBand(Child1);  //印空白表格
  end;         
  child1.visible := False;      
end;

procedure Memo6OnBeforePrint(Sender: TfrxComponent);
begin
  if not Engine.FinalPass then exit;
  //Memo6.Lines[0] := '总页号:'+IntToStr(PageList[FGIndex]);
  Memo6.Lines[0] := '总页号:'+IntToStr(FGIndex+1);     
end;                                                                                                                                                                                

procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
  PageLine := <Line> mod PageMaxRow;
  if (PageLine = 1) and (<line> > 1) then
    Engine.newpage;
  child1.visible := False;
end;

//如果仅在最后一页补空行可用

{procedure Footer1OnBeforePrint(Sender: TfrxComponent);
var
  i: integer;   
begin
   i := iif(PageLine=0, PageMaxRow, PageLine);
  child1.visible := True;       
  while i < PageMaxRow do
  begin
    i := i + 1;
    Engine.ShowBand(Child1);  //印空白表格
  end;         
  child1.visible := False;      
end;}


begin
  FGIndex :=0;       
end.

FastReport界面为:

posted on 2010-08-27 17:07  孤独的猫  阅读(3452)  评论(0编辑  收藏  举报