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 6:06AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.