提供2个方法参考一下: 1.在fastreport中,用一个全局变量totAmt累加获得,适用每页合计var totAmt:Double;procedure PageHeader1OnBeforePrint(Sender: TfrxComponent); begin totAmt:=0; end;procedure Memo1OnAfterPrint(Sender: TfrxComponent); begin if Engine.Finalpass and (Memo1.Value>0) then totAmt:=totAmt+StrToFloat(FormatFloat('0.##',Memo1.Value)); end;procedure Memo2OnBeforePrint(Sender: TfrxComponent); begin Memo2.Text:=FloatTostr(totAmt); end;2.如果是整个报表总合计,可以在程序中用sql语句取得合计结果totAmt; 在fastreport中用一Memo设置内容为[kk],再在程序中的frxReport1GetValue事件中赋值procedure TForm1.frxReport1GetValue(const VarName: String; var Value: Variant); begin if uppercase(VarName)='KK' then Value:=FormatFloat('0.##',totAmt); end;
1.在fastreport中,用一个全局变量totAmt累加获得,适用每页合计var
totAmt:Double;procedure PageHeader1OnBeforePrint(Sender: TfrxComponent);
begin
totAmt:=0;
end;procedure Memo1OnAfterPrint(Sender: TfrxComponent);
begin
if Engine.Finalpass and (Memo1.Value>0) then
totAmt:=totAmt+StrToFloat(FormatFloat('0.##',Memo1.Value));
end;procedure Memo2OnBeforePrint(Sender: TfrxComponent);
begin
Memo2.Text:=FloatTostr(totAmt);
end;2.如果是整个报表总合计,可以在程序中用sql语句取得合计结果totAmt;
在fastreport中用一Memo设置内容为[kk],再在程序中的frxReport1GetValue事件中赋值procedure TForm1.frxReport1GetValue(const VarName: String;
var Value: Variant);
begin
if uppercase(VarName)='KK' then
Value:=FormatFloat('0.##',totAmt);
end;