1) only with "OnBeginBand" NOT with "OnEndBand"
Yes, you must break the band at "OnBeginBand" event. When "OnEndBand" is fired the band is already printed, make no sense to set ForceNewPage to true, it won't have any effect.
2) only with "Band.Typ = btMasterData" NOT "Band.Typ = btDetailData" is it right?
I don't know all the details of your project but if it works with btMasterData by all means use that.
And the only problem is that the first page has only the ReportTitle.
Set a global, boolean variable(FirstTime for example) to true on the following events: OnBeginDoc and OnBeforePrint, then:
//...
type
TForm1 = class(TForm)
private
FFirstTime: Boolean;
public
end;
//...
procedure TForm1.frReport1BeforePrint(Sender: TfrReport);
begin
FFirstTime := True;
end;
procedure TForm1.frReport1BeginDoc;
begin
FFirstTime := True;
end;
procedure TForm1.frReport1BeginBand(Band: TfrBand);
begin
if (Band.Typ = btMasterData) and (Band.Name = 'myMasterBand') then
begin
if FFirstTime then
begin
FFirstTime := False;
Exit;
end;
Band.ForceNewPage := True;
//put other stuff here if needed
end;
end;
Thanks again GetMem
You're welcome!
PS: You should give fortes report a try. It's similar to quickreport, with much more options then lazreport.