![](/img/trans.png)
[英]FastReport - How to sum specific groupfooter values to a new footer band
[英]How to write events of “fastreport band” in delphi code
我的fastreport中有masterdata带。 我可以在pascal脚本中在“打印后的masterdata”上编写代码,但是我想知道是否有一种以主要delphi形式编写此代码的方法。
Pascal脚本:
procedure MasterDataOnAfterPrint(Sender : TfrxComponent)
begin
Sup_Page.Text := 'Cont on Page ' + IntToStr(<Page> + 1);
end;
您有不同的选择来干扰打印时的报告。
您可以使用事件AfterPrint
和/或BeforePrint
,它们将在每次打印时将组件作为参数提供。
如果要访问事件中提供的另一个组件,则可以使用FindComponent为实际打印的页面提供该组件。
要访问报表中的函数,您可以使用函数名称作为参数调用Calc
。
根据您的需求,另一个选择是使用GetValue
事件,该事件在每次评估变量时都会调用,提供变量的名称和该值的var参数,这将使您能够返回所需的值。
一个简短的示例可能会有用:
procedure TFormOrDM.frxReport1AfterPrint(Sender: TfrxReportComponent);
begin
// if Sender is TfrxMasterdata then // Filter out all Masterdatasets
if Sender.Name = 'Masterdata1' then // Filter out a specific Masterdatasets
begin
TFrxMemoView(frxReport1.FindComponent('Sup_Page')).Text := 'Cont on Page ' + FloatToStr(frxReport1.Calc('<Page>') + 1);
end;
end;
procedure TFormOrDM.frxReport1BeforePrint(Sender: TfrxReportComponent);
begin
// Another place you might use to acsess components
end;
procedure TFormOrDM.frxReport1GetValue(const VarName: string; var Value: Variant);
begin
if VarName = 'myValue' then // own variable defined in the report
Value := 'Cont on Page ' + FloatToStr(frxReport1.Calc('<Page>') + 1);
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.