Previewing a report

Top  Previous  Next

A report can be displayed in the preview window in two ways: either by calling the “TfrxReport.ShowReport” method (described above) or by calling the “TfrxReport.ShowPreparedReport” method. The second method does not build the report but will display a finished report. This means that the report should either have been built beforehand, using the “PrepareReport” method, or loaded from a previously built report which has been saved in a file (see “Loading and saving a report”).

 

Example:

 

Pascal:

 

if frxReport1.PrepareReport then

 frxReport1.ShowPreparedReport;

 

C++:

 

if(frxReport1->PrepareReport(true))

 frxReport1->ShowPreparedReport();

 

Using this code the report is built first before being displayed in the preview window. Building a large report can take a significant time. It is better to use the “ShowReport” method rather than “PrepareReport” and “ShowPreparedReport” as “ShowReport” gives visual feedback of the report building. Settings for the report preview can be made in the “TfrxReport.PreviewOptions” property.