zoukankan      html  css  js  c++  java
  • 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界面为:

  • 相关阅读:
    Python学习第106天(Django的静态文件static、url分组)
    Python学习第105天(Django初步实现)
    Python学习第104天(Django前传web框架)
    Python学习第103天(http协议)
    Python学习第102(数据库进阶)
    Python学习第101天(mysql索引)
    Python学习第100天(多表查询:连接查询、复合查询、子查询)
    Python学习第99天(子网划分)
    java强制转换+自动转换
    WINDOWS快捷键
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/1810274.html
Copyright © 2011-2022 走看看