2014-11-19 20 views
0

내 빠른 내 보고서에 masterdata 밴드가 있습니다. 파스칼 스크립트에서 "masterdata After Print"코드를 작성할 수는 있지만, 주요 델파이 형식으로이 코드를 작성하는 방법은 알고 싶습니다."fastreport band"이벤트를 델파이 코드로 작성하는 방법

파스칼 스크립트 :

procedure MasterDataOnAfterPrint(Sender : TfrxComponent) 
begin 
    Sup_Page.Text := 'Cont on Page ' + IntToStr(<Page> + 1); 
end; 
+0

당신은 frxReport1AfterPrint (보낸 사람 : TfrxReportComponent)'을 찾고 계십니까,'또는 당신이 찾고있는 [FastReport 4 사용자 정의 델파이 기능을 사용하는 방법?] (http://stackoverflow.com/questions/15730822/how-to-use-custom-delphi-function-in-fastreport-4) – bummi

+0

메신저 델파이 코드에서 빠른 보고서 구성 요소의 이벤트를 찾고 ... 예를 들어 (보낸 사람 TfrxMasterData로) .AfterPrint : = CustomProcedure; –

답변

1

당신은 인쇄하는 동안 보고서를 INTERFER 서로 다른 옵션이 있습니다.
인쇄 할 때마다 매개 변수로 구성 요소를 제공하는 이벤트 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; 

enter image description here

+0

정말 고맙습니다. –