[英]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.