在Detail的OnPrint中计数,到了5的时候用NewPage强制换页,
不足5行可用空记录补.

解决方案 »

  1.   

    prometheusphinx 补空记录怎么做?详细点行吗!!!
      

  2.   

    在ONNEEDDATA中自己控制,打印5行换页,如不足的话,停止记录移动,把相应的RQDBTEXT,QRLABE等DISABLED,如有线条照样打印。
    我目前就使用这种方法打印发票,但要求你的打印每一行数据的高度是一样的,不然的话,就
    比较麻烦,最好是固定打印机和纸张大小。因为不同的打印机的分辨率不同,中间打印五行数据的
    纸张高度会不一样,会造成第五行打印一半。
      

  3.   

    我将每页打印行数设定为5行时,在EPSON 1600K上居然空走纸,不打印!Why??
      

  4.   

    每次打印前要将数据指针置first;
      

  5.   

    用了First, But it is also.
      

  6.   

    如果你有quickreport的源代码可以这样改造,下面代码是需要加入的。
    由于这里不一定说的清楚,你如果写过控件可以自己改造,代码就这些,
    如果不行可以和我单独交流:  TQrCustomController = class(TComponent) {控制}
    private
        FDetailPerPage: integer;
        procedure SetDeatilPerPage(APerPage: integer);
    public
          property DetailPerPage: integer read FDetailPerPage write   SetDeatilPerPage;
    end;
    TCustomQrReport = class(TQrBasePanel)
    private
        FDetailPerPage: integer;
        procedure SetDeatilPerPage(APerPage: integer);
    public
        procedure PrintBandchildNone(ABand: TNoteCustomBand); {打印但没有孩子}
        property DetailPerPage: integer read FDetailPerPage write SetDeatilPerPage;
    end;
    procedure TCustomNotePaint.PrintBandchildNone(ABand: TNoteCustomBand);
    {打印但没有孩子}
    var
      dmy: integer;
    begin
      if ABand <> nil then
      begin
        if ABand.AlignToBottom then
        begin
          if Page.Orientation = poPortrait then
            dmy := round(QRPrinter.PaperLength - Page.BottomMargin -
              ABand.Size.Length - FPageFooterSize)
          else
            dmy := round(QRPrinter.PaperWidth - Page.BottomMargin -
              ABand.Size.Length - FPageFooterSize);
          if dmy > CurrentY then
            CurrentY := dmy;
        end;
        ABand.PrintNoChild;
      end;
    end;
    //加入固定数目的空白行procedure TQrController.PrintBlankFooter(Anum: integer);
    var
      I, j: integer;
      TmpBand: TNoteband;
      TmpColor: tColor;
    begin
      if Anum = 0 then
        exit;
      if Anum = FDetailPerPage then
        exit;
      TmpBand := TQrBand.Create(FParentReport);
      TmpBand.BandType := rbSummary;
      TmpBand.Frame.DrawLeft := true;
      TmpBand.Frame.DrawRight := true;
      TmpBand.Frame.DrawBottom := true;
      if ((FDetail <> nil) and (FDetail.ControlCount > 0)) then
        TmpColor := TQrCustomLabel(FDetail.Controls[0]).Font.Color;
      for I := Anum - 1 downto 0 do
      begin
        for j := 0 to FDetail.ControlCount - 1 do
        begin
          TQrCustomLabel(FDetail.Controls[j]).Font.Color := FDetail.Color;
          {颜色为底色}
        end;
        FParentReport.PrintBandchildNone(FDetail);
        {有效但造成了最后一条记录的重复计算,修改后已经解决}
        for j := 0 to FDetail.ControlCount - 1 do
        begin
          TNoteCustomLabel(FDetail.Controls[j]).Font.Color := TmpColor;
        end;
      end;
      TmpBand.Free;
    end;
    ///Suny modified 2000.3.15 one functionprocedure TQrCustomController.SetDeatilPerPage(APerPage: integer);
    begin
      FDetailPerPage := APerPage;
    end;///Suny modified 2000.3.15 one functionprocedure TCustomQrReport.SetDeatilPerPage(APerPage: integer);
    begin
      FDetailPerPage := APerPage;
      Controller.DetailPerPage := AperPage;
    end;
    在procedure TQrController.Execute;函数中找到:
              ParentReport.QRPrinter.Progress := (Longint(DetailNumber) * 100) div
                RecCount;
    一句,在其后加入
            if FDetailPerPage <> 0 then
            begin
              if (FDetailNumber mod FDetailPerPage) = 0 then
              begin
                if assigned(FFooter) then
                begin
                  if (SelfCheck is TCustomNotePaint) and
                    FFooter.AlignToBottom then
                    ;
                  // ParentReport.FPageFooterSize := 0;
                  if (FFooter <> nil) and (ParentReport.PageNumber = 0) then
                    ParentReport.NewPage;
                  ParentReport.PrintBand(FFooter);
                end;再找到:
          CheckLastGroupFooters;
          PrintGroupFooters;
          if assigned(FFooter) then
          begin
            if (SelfCheck is TCustomNotePaint) and
              FFooter.AlignToBottom then
              ;
    在其前加入:
          if FDetailPerPage <> 0 then
            if detailNumber = RecCount then
              PrintBlankFooter(FDetailPerPage - (RecCount mod FDetailPerPage));