Page break from pascal code condition

FastReport NewPage property

Hi,

Say I have a report with three bands

FirstBand
Secondband
ThirdBand

...which is printed continously on the paper regardless of page breaks. However when a certain condition occurs I need FirstBand to start at the top of a new page. To achieve this I tried to use the procedure
below:

procedure SetBandNewPage(aReport:TFRReport;aObject:string);
var
BV : TFRBandView;
begin
BV := TFRBandView(aReport.FindObject(aObject));
if BV <> NIL then
TFRBandView(BV).Prop := TRUE
else
ShowMessage('Programming error: SetBandNewPage '+aObject+' not found');
end;

... and call it like this:

if <condition> then
SetBandNewPage(repStatement,'FirstBand');

I've tried to call this from any of the bands' OnBeginBand events with no luck. How should I do this correctly?

Also another question: How can I assign a custom text to the PreView's title bar (form caption)?

thanks a lot for any advice on these issues.

Tor

Comments

  • edited 10:34PM
    Hi!

    I didn't do a thing like this. Ie. controlling pagebreak from delphi level. But I use pagebreak from inside the report. This can be achieved by calling the NewPage internal procedure in any band's OBP event handler depending on any condition I want.

    The second problem: You can rewrite the FR designer (FR_Desgn.pas) or You can create a custom preview window using the TFRPreview component.

    Regards: Alex

Leave a Comment