• FastReport分组打印并且指定每页行数(不足填空行)


    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界面为:

  • 相关阅读:
    百度地图bd map使用方法
    Nodejs学习笔记2
    Nodejs学习笔记-1
    npm的安装和使用?
    如何使用jqueryUi的datepicker日历控件?
    如何 使用vim的 session和viminfo 恢复上一次工作的环境??
    Yii使用笔记 2
    关于link标签的用法, 不声明rel=stylesheet则无效? 在ff中必须声明rel属性!
    物联网产业链八大环节全景图
    一场改变你投资生涯的讨论:职业德州扑克手看交易
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/1810274.html
Copyright © 2020-2023  润新知