I tried your code : 36 empty pages.
Thus, I tried :
type
TForm1 = class(TForm)
Filas: TfrUserDataset;
frCompositeReport1: TfrCompositeReport;
[...]
procedure TheReportEnterRect(Memo: TStringList; View: TfrView);
procedure TheReportGetValue(const ParName: String; var ParValue: Variant);
[...]
end;
procedure TForm1.Button12Click(Sender: TObject);
var
i : integer;
begin
with frCompositeReport1 do begin
DoublePass:= True;
Reports.Clear;
end;
for i := 1 to 36 do begin
sgEL.Row := i;
TheReport :=TfrReport.Create(self);
TheRepor.OnEnterRect:= @TheReportEnterRect;
TheReport.OnGetValue:= @TheReportGetValue;
TheReport.Dataset := Filas;
TheReport.loadFromFile(gsReportPath+'myReport.lrf');
//TheReport.PrepareReport;
//TheReport.ShowReport; {The 36 pages are OK}
frCompositeReport1.Reports.add(TheReport);
end;
frCompositeReport1.ShowReport;
It always looks like it has 36 copies of the same report (the last page). With ' TheReport.PrepareReport + TheReport.ShowReport ', each of the reports 'TheReport' is correct.
I also tried :
var TheReport : array [1..100] of TfrReport;
begin
for i := 1 to 36 do begin
sgEL.Row := i;
TheReport[i]:=TfrReport.Create(self);
TheReport[i].OnEnterRect:= @TheReportEnterRect;
TheReport[i].OnGetValue:= @TheReportGetValue;
TheReport[i].Dataset := Filas;
TheReport[i].loadFromFile(gsReportPath+'myReport.lrf');
// TheReport[i].PrepareReport;
// TheReport[i].ShowReport; {It's OK}
frCompositeReport1.Reports.add(TheReport[i]);
TheReport[i].Free;
end;
frCompositeReport1.ShowReport;
After the last " TheReport(i).Free;" --> Exception class 'External : SIGSEGV'.
Without 'TheReport(i).Free;', the result is the same: 36 identical pages (the last one). With ' TheReport(i).PrepareReport + TheReport(i).ShowReport ', each of the reports 'TheReport(i)' is also correct.