FastReport 合并项 支持自适应高

模板链接:点我下载

文档链接点我下载

视频链接:点我观看

var
 iRowCount:Integer;
 AryHeight:Array of Extended;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
var
 i,iRepeat: Integer;  sLastValue,sCurValue: String;
 MyDataSet: TfrxDBDataSet;
 begin
    MyDataSet := TfrxDBDataSet(Report.GetDataSet('frxDBDataset1'));
    iRowCount := MyDataSet.RecordCount;
    SetLength(AryHeight,iRowCount);
    MyDataSet.First;  sCurValue := '';
    for i := 0 to iRowCount - 1 do
    begin

       sLastValue := sCurValue;
       sCurValue := <frxDBDataset1."MO_NO">;
       if (sLastValue <> '') and (sLastValue = sCurValue) then
       begin
          iRepeat := iRepeat + 1;
          AryHeight[i] := 0;
          AryHeight[i - iRepeat] := MasterData1.Height * (iRepeat + 1);
       end
       else
       begin
          iRepeat := 0;
          AryHeight[i] := MasterData1.Height;
     end;
     MyDataSet.Next;
   end;
 end;

procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin

   if AryHeight[<Line#> - 1] = 0 then
  begin
    Memo8.Frame.Typ:=ftLeft+ftRight;
    Memo15.Frame.Typ:=ftLeft+ftRight;
    Memo6.Frame.Typ:=ftLeft+ftRight;
    Memo5.Frame.Typ:=ftLeft+ftRight;
  end
  else begin
    Memo8.Frame.Typ:=ftLeft+ftRight+ftTop;
    Memo15.Frame.Typ:=ftLeft+ftRight+ftTop;
    Memo6.Frame.Typ:=ftLeft+ftRight+ftTop;
    Memo5.Frame.Typ:=ftLeft+ftRight+ftTop;
  end;
end;
begin
end.
最后修改:2024 年 03 月 02 日
如果觉得我的文章对你有用,请随意赞赏