Turbo Delphi Pro で FastReport 4.7.31 を使用しています。
次の手順では、ユーザー入力に応じて、いくつかの日付付きファイルに格納されているデータを処理します。
procedure TfrmMain.MyReportPrint;
var MDate : Tdate;
S, myfile : string;
firstone: boolean;
// Date1, Date2 & ShowPreview are global variables set via a dialog box
begin
firstone := true;
MDate := Date1;
while MDate < IncDay(Date2, 1) do
begin
DateTimeToString(S,'yyyymmdd',MDate);
myfile := 'm' + S + '.dbf';
if FileExists(DataPath + '\' + myfile) then
begin
tblPS.Close;
tblPS.TableName := myfile;
frxMyReport.PrepareReport(firstone);
firstone := false;
end;
MDate := IncDay(MDate, 1);
end;
if ShowPreview then frxMyReport.ShowReport else frxMyReport.Print;
end;
frxMyReport.Print はすべてのページを印刷します。
frxMyReport.ShowReport は、準備された最後のページのみを表示します。