各位大侠如题是关于fastreport的报表打印中怎样在一页上打印固的行数,多余的行数新起一页打印,不足的用空行补足。如进货单编号20130512中共有12条单据,需要分两页打印、有6条信息时就在一张单据上打印再补充两行空行,求实现方法?delphi fastreport

解决方案 »

  1.   

    提问前搜一下以前的贴子。http://bbs.csdn.net/topics/390438320
      

  2.   


    var
      PageMaxRow: integer=19;//行数
    procedure Footer1OnBeforePrint(Sender: TfrxComponent);
    begin
      PageMaxRow:=19;
      if <Page>=<TotalPages> then
      begin
        PageMaxRow:= PageMaxRow-strtoint(<DataLines>) mod PageMaxRow;
        if PageMaxRow>0 then
        begin
          child1.visible := True;
          Engine.ShowBand(Child1);
        end;
        child1.visible := False;
      end;
    end;procedure ReportSummary1OnBeforePrint(Sender: TfrxComponent);
    var
      i: integer;
      Memo1: TfrxMemoView;
    begin
      PageMaxRow:=19;
      if <Page>=<TotalPages>-1 then
      if strtoint(<DataLines>)mod PageMaxRow=0 then
      begin
        PageMaxRow:=PageMaxRow-2;
        if PageMaxRow>0 then
        begin
          while i < PageMaxRow do
          begin
            i := i + 1;
            Memo1:= TfrxMemoView.Create(ReportSummary1);
            Memo1.Text := '  <';
            Memo1.Height :=Memo2.Height+3;
            Memo1.width:=400;
            Memo1.left:=10;
            Memo1.top:=Memo2.Height*2+i*Memo1.Height+5;
            Memo1.Align :=baNone;
          end;
        end;
      end;  if <Page>=<TotalPages> then
      begin    
        Memo25.text:='------------ CLOSED ------------';
        if strtoint(<DataLines>)mod PageMaxRow=0 then
        begin
          PageMaxRow:=PageMaxRow-2;
        end
        else
        begin
          PageMaxRow:= PageMaxRow-strtoint(<DataLines>)mod PageMaxRow;     
          PageMaxRow:= PageMaxRow-3;
        end;
        if PageMaxRow>0 then
        begin
          while i < PageMaxRow do
          begin
            i := i + 1;
            Memo1:= TfrxMemoView.Create(ReportSummary1);
            Memo1.Text := '  <';
            Memo1.Height :=Memo2.Height+3;
            Memo1.width:=400;
            Memo1.left:=10;
            Memo1.top:=Memo2.Height*2+i*Memo1.Height+5;
            Memo1.Align :=baNone;
          end;
        end;
      end;
    end;procedure PageFooter1OnBeforePrint(Sender: TfrxComponent);
    begin
      if <Page>=<TotalPages> then
        Memo25.text:='------------ CLOSED ------------';
    end;beginend.
    其中DataLines是程序传进来的变量就是数据总行数  
    添加Memo2,Memo25,PageFooter1,ReportSummary1控件
    还需要自己琢磨下把