FastReport预览不显示所有页面

时间:2010-05-07 14:39:28

标签: delphi preview fastreport

我在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显示仅编写最后一页

1 个答案:

答案 0 :(得分:2)

ShowReport方法采用可选参数ClearLastReport,其默认值为 true 。无论是真还是假,ShowReport在显示之前都会准备报告,因此在您的代码中,您将丢弃已准备好的所有内容,然后使用最近分配的表格设置重新准备报告。如果您对代码进行的唯一更改是将False传递给ShowReport,那么您会发现预览显示了所有网页,但重复了最后一页。

ShowReport相比,Print方法准备报告。它只打印已经准备好的内容。您希望ShowPreparedReport用于预览,而不是ShowReport。请参阅 FastReport程序员手册的第1.9节。

相关问题