W
wzjlg
Unregistered / Unconfirmed
GUEST, unregistred user!
fastreport 合并相同行的问题,用的是 fastreport3.25 合并的相关代码写在 报表文件中,只有30分了 ;大哥可以到"http://user.qzone.qq.com/550608294 相册",看看打印的图片,就明白了 ( 积分: 30 )<br />var
test1:string;
function GetMax(I,I1:Integer):Integer
begin
if I>I1 then
Result:=I
else
Result:=I1;
end;
//使用MC.Height作为标准高度
function GetStandHeight(H:Extended):Integer;
begin
if H Mod MClassSet.Height>0 then
Result:=Int(H-H mod MClassSet.Height+MClassSet.Height)
else
Result:=Int(H);
end;
procedure MClassSetOnAfterData(Sender: TfrxComponent);
begin
if <Line>=1 then
MClassSet.Tag:=Int(MClassSet.Height)
else
MClassSet.Tag:=MClassSet.Tag+Int(MClassSet.Height);
//
end;
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if <Line>=1 then
MName_A.Visible:=True;
end;
procedure MLineOnAfterData(Sender: TfrxComponent);
begin
MLine.Tag:=GetStandHeight(MLine.CalcHeight);
MLine.Visible:=False;
end;
procedure MNameOnAfterData(Sender: TfrxComponent);
begin
MName.Tag:=GetStandHeight(MName.CalcHeight);
MName.Visible:=False;
end;
procedure MyindaogzrOnAfterData(Sender: TfrxComponent);
begin
Myindaogzr.Tag:=GetStandHeight(Myindaogzr.CalcHeight);
Myindaogzr.Visible:=false;
end;
procedure MKuanggonggzrOnAfterData(Sender: TfrxComponent);
begin
MKuanggonggzr.Tag:=GetStandHeight(MKuanggonggzr.CalcHeight);
MKuanggonggzr.Visible:=false;
end;
procedure MShidaogzrOnAfterData(Sender: TfrxComponent);
begin
MShidaogzr.Tag:=GetStandHeight(MShidaogzr.CalcHeight);
MShidaogzr.Visible:=false;
end;
procedure MgongchugzrOnAfterData(Sender: TfrxComponent);
begin
Mgongchugzr.Tag:=GetStandHeight(Mgongchugzr.CalcHeight);
Mgongchugzr.Visible:=false;
end;
procedure MjiarigzrOnAfterData(Sender: TfrxComponent);
begin
Mjiarigzr.Tag:=GetStandHeight(Mjiarigzr.CalcHeight);
Mjiarigzr.Visible:=false;
end;
procedure MCDOnAfterData(Sender: TfrxComponent);
begin
MCD.Tag:=GetStandHeight(MCD.CalcHeight);
MCD.Visible:=false;
end;
procedure MNightClassCountOnAfterData(Sender: TfrxComponent);
begin
MNightClassCount.Tag:=GetStandHeight(MNightClassCount.CalcHeight);
MNightClassCount.Visible:=false;
end;
procedure MZTOnAfterData(Sender: TfrxComponent);
begin
MZT.Tag:=GetStandHeight(MZT.CalcHeight);
MZT.Visible:=false;
end;
procedure qingjiagzrOnAfterData(Sender: TfrxComponent);
begin
qingjiagzr.Tag:=GetStandHeight(qingjiagzr.CalcHeight);
qingjiagzr.Visible:=false;
end;
procedure MGHOnAfterData(Sender: TfrxComponent);
begin
TfrxMemoView(Sender).Top:=TfrxMemoView(Sender).Top-MClassSet.Tag;
TfrxMemoView(Sender).Height:=GetMax(MClassSet.Tag,MName.Tag);
end;
procedure MName_AOnAfterData(Sender: TfrxComponent);
begin
MName_A.TOP:=MName_A.TOP-MClassSet.Tag;
MName_A.Height:=GetMax(MClassSet.Tag,MName.Tag);
end;
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
var
I,I1,Count:Integer;
Rest:Extended;
M:TFrxMemoView;
LeftS:Array[0..1] of Extended;
WidthS:Array[0..1] of Extended;
Const
MName1='yuanguoxing';
procedure CreateMemo(Index:Integer);
begin
if Sender.FindObject(MName1+InttoStr(Index))<>nil then
M:=TfrxmemoView(Sender.FindObject(MName1+InttoStr(Index)))
else
begin
M:=TfrxMemoView.Create(Sender);
M.Name:=MName1+IntToStr(Index);
M.Frame.Typ:=15;
GroupFooter1.Tag:=GroupFooter1.Tag+1;
M.Parent:=Sender;
M.Height:=MClassSet.Height;
M.Top:=Index div 2 * MClassSet.Height;
end;
M.Width:=WidthS[Index mod 2];
M.Left:=LeftS[Index mod 2];
M.Visible:=True;
end;
begin
if not Engine.FinalPass then
Exit;
Count:=MName.Tag-MClassSet.Tag;
GroupFooter1.Height:=GetMax(Count,0);
if Count<=0 then
for I:=0 to GroupFooter1.Tag-1do
TfrxView(Sender.FindObject(MName1+InttoStr(I))).Visible:=False
else
begin
LeftS[0]:=MClassSet.Left;
LeftS[1]:=M01.Left;
WidthS[0]:=M01.Width;
WidthS[1]:=MClassSet.Width;
Rest:=Count mod MClassSet.Height;
if Rest>0 then
Rest:=MClassSet.Height;
Count:=(Count div Int(MClassSet.Height))*2;
for I:=0 to Count-1do
CreateMemo(I);
if Rest>0 then
begin
CreateMemo(I+1);
CreateMemo(I+2);
Count:=Count+2;
end;
for I:=Count to GroupFooter1.Tag-1do
TfrxView(Sender.FindObject(MName1+InttoStr(I))).Visible:=False;
end;
end;
begin
end.
test1:string;
function GetMax(I,I1:Integer):Integer
begin
if I>I1 then
Result:=I
else
Result:=I1;
end;
//使用MC.Height作为标准高度
function GetStandHeight(H:Extended):Integer;
begin
if H Mod MClassSet.Height>0 then
Result:=Int(H-H mod MClassSet.Height+MClassSet.Height)
else
Result:=Int(H);
end;
procedure MClassSetOnAfterData(Sender: TfrxComponent);
begin
if <Line>=1 then
MClassSet.Tag:=Int(MClassSet.Height)
else
MClassSet.Tag:=MClassSet.Tag+Int(MClassSet.Height);
//
end;
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if <Line>=1 then
MName_A.Visible:=True;
end;
procedure MLineOnAfterData(Sender: TfrxComponent);
begin
MLine.Tag:=GetStandHeight(MLine.CalcHeight);
MLine.Visible:=False;
end;
procedure MNameOnAfterData(Sender: TfrxComponent);
begin
MName.Tag:=GetStandHeight(MName.CalcHeight);
MName.Visible:=False;
end;
procedure MyindaogzrOnAfterData(Sender: TfrxComponent);
begin
Myindaogzr.Tag:=GetStandHeight(Myindaogzr.CalcHeight);
Myindaogzr.Visible:=false;
end;
procedure MKuanggonggzrOnAfterData(Sender: TfrxComponent);
begin
MKuanggonggzr.Tag:=GetStandHeight(MKuanggonggzr.CalcHeight);
MKuanggonggzr.Visible:=false;
end;
procedure MShidaogzrOnAfterData(Sender: TfrxComponent);
begin
MShidaogzr.Tag:=GetStandHeight(MShidaogzr.CalcHeight);
MShidaogzr.Visible:=false;
end;
procedure MgongchugzrOnAfterData(Sender: TfrxComponent);
begin
Mgongchugzr.Tag:=GetStandHeight(Mgongchugzr.CalcHeight);
Mgongchugzr.Visible:=false;
end;
procedure MjiarigzrOnAfterData(Sender: TfrxComponent);
begin
Mjiarigzr.Tag:=GetStandHeight(Mjiarigzr.CalcHeight);
Mjiarigzr.Visible:=false;
end;
procedure MCDOnAfterData(Sender: TfrxComponent);
begin
MCD.Tag:=GetStandHeight(MCD.CalcHeight);
MCD.Visible:=false;
end;
procedure MNightClassCountOnAfterData(Sender: TfrxComponent);
begin
MNightClassCount.Tag:=GetStandHeight(MNightClassCount.CalcHeight);
MNightClassCount.Visible:=false;
end;
procedure MZTOnAfterData(Sender: TfrxComponent);
begin
MZT.Tag:=GetStandHeight(MZT.CalcHeight);
MZT.Visible:=false;
end;
procedure qingjiagzrOnAfterData(Sender: TfrxComponent);
begin
qingjiagzr.Tag:=GetStandHeight(qingjiagzr.CalcHeight);
qingjiagzr.Visible:=false;
end;
procedure MGHOnAfterData(Sender: TfrxComponent);
begin
TfrxMemoView(Sender).Top:=TfrxMemoView(Sender).Top-MClassSet.Tag;
TfrxMemoView(Sender).Height:=GetMax(MClassSet.Tag,MName.Tag);
end;
procedure MName_AOnAfterData(Sender: TfrxComponent);
begin
MName_A.TOP:=MName_A.TOP-MClassSet.Tag;
MName_A.Height:=GetMax(MClassSet.Tag,MName.Tag);
end;
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
var
I,I1,Count:Integer;
Rest:Extended;
M:TFrxMemoView;
LeftS:Array[0..1] of Extended;
WidthS:Array[0..1] of Extended;
Const
MName1='yuanguoxing';
procedure CreateMemo(Index:Integer);
begin
if Sender.FindObject(MName1+InttoStr(Index))<>nil then
M:=TfrxmemoView(Sender.FindObject(MName1+InttoStr(Index)))
else
begin
M:=TfrxMemoView.Create(Sender);
M.Name:=MName1+IntToStr(Index);
M.Frame.Typ:=15;
GroupFooter1.Tag:=GroupFooter1.Tag+1;
M.Parent:=Sender;
M.Height:=MClassSet.Height;
M.Top:=Index div 2 * MClassSet.Height;
end;
M.Width:=WidthS[Index mod 2];
M.Left:=LeftS[Index mod 2];
M.Visible:=True;
end;
begin
if not Engine.FinalPass then
Exit;
Count:=MName.Tag-MClassSet.Tag;
GroupFooter1.Height:=GetMax(Count,0);
if Count<=0 then
for I:=0 to GroupFooter1.Tag-1do
TfrxView(Sender.FindObject(MName1+InttoStr(I))).Visible:=False
else
begin
LeftS[0]:=MClassSet.Left;
LeftS[1]:=M01.Left;
WidthS[0]:=M01.Width;
WidthS[1]:=MClassSet.Width;
Rest:=Count mod MClassSet.Height;
if Rest>0 then
Rest:=MClassSet.Height;
Count:=(Count div Int(MClassSet.Height))*2;
for I:=0 to Count-1do
CreateMemo(I);
if Rest>0 then
begin
CreateMemo(I+1);
CreateMemo(I+2);
Count:=Count+2;
end;
for I:=Count to GroupFooter1.Tag-1do
TfrxView(Sender.FindObject(MName1+InttoStr(I))).Visible:=False;
end;
end;
begin
end.