修改fastreport实现页尾补空白行或打印固定行数

来源:互联网 发布:mac无法开机 编辑:程序博客网 时间:2024/04/30 03:06

刚刚实现成功,“页尾剩余补空白行”和“打印固定行数”两种模式




代码:

frxClass加:

  //在DataBand末尾加空白行

//abcNone不启用,abcByRecordCount按记录数加,abcByFreeSpace按页面剩余空间加
  TfrxAppendBlankCells = (abcNone, abcByRecordCount, abcByFreeSpace);


TfrxDataBand位置加:

published

    //在DataBand末尾加空白行 --2014-12-1--
    property AppendBlankCells: TfrxAppendBlankCells read FAppendBlankCells write FAppendBlankCells default abcNone;
  public
    BlankCells: Boolean;//此属性为true,块内文本框的不显示文字


改函数

procedure TfrxCustomMemoView.GetData;

.....

if IsDataField then
  begin
    //Band在BlankCells模式下不打印文字,这样就可能通过Band的RowCount指定固定的打印行数 --Conch 2014-12-1--
    if (Parent is TfrxDataBand) and (TfrxDataBand(Parent).BlankCells) then
      FMemo.Text := ''
    else



    if DataSet.IsBlobField(DataField) then
    begin

.....



frxEngine加:

procedure ShowBandTree(Obj: TObject);函数加:

  Label Loop_AppendBlank;

    for i := 0 to Bands.Count - 1 do
    begin
      ..........
      ResetSuppressValues(b);


      //在Band末尾追加空行,这样就可能通过Band的RowCount指定固定的打印行数 --2014-12-1--
      b.BlankCells := false;
Loop_AppendBlank:

      while not b.DataSet.Eof do

      end;

      //在DataBand末尾追加空行,这样就可能通过Band的RowCount指定固定的打印行数 --2014-12-1--

      if (b.AppendBlankCells <> abcNone) and (not b.BlankCells)
        and ( ((b.AppendBlankCells = abcByRecordCount) and (b.DataSet <> nil) and (b.RowCount > 0) and (b.FLineThrough <= b.RowCount))
          or ((b.AppendBlankCells = abcByFreeSpace) and (b.Height <= FreeSpace))
        )
      then begin
        b.Stretched := false;//禁止扩大高度
        b.BlankCells := true;
        if b.AppendBlankCells = abcByRecordCount then begin
          //挂接成虚拟数据集
          b.DataSet := b.VirtualDataSet;
          b.VirtualDataSet.RangeEndCount := b.RowCount - b.FLineThrough + 1;
          b.DataSet.Initialize;
          goto Loop_AppendBlank;
        end
        else if b.AppendBlankCells = abcByFreeSpace then
          //循环产生内容,直接剩余空间放不下
          while b.Height <= FreeSpace do begin
            CurLine := b.FLineN;
            CurLineThrough := b.FLineThrough;
            DoShow(b);
            Inc(b.FLineN);
            Inc(b.FLineThrough);
          end;
      end;


完工。


----作者:狂歌,Q63823961(无事勿扰,通常不作答),转载请注明出版--------



0 0
原创粉丝点击