<< Click to display table of contents >> TRVReportGenerator.Execute |
Processes a report template contained in RV (or RVData), and produces a final report.
function Execute(RV: TCustomRichView;
UseThread: Boolean = False): Boolean;
function Execute(RVData: TCustomRVData;
UseThread: Boolean = False): Boolean;
The resulting document is not formatted, call RV.Format when report generation is complete.
If you call Execute with UseThread = False, the method generates a report and finishes when generation is completed.
If generation takes a long time, the application does not respond while this method is working. To solve this problem, you can call Application.ProcessMessages in OnDataQueryProgress event. However, this method is not cross-platform, so it is not recommended to use it in FireMonkey applications. See also notes below.
In OnDataQueryProgress event, you can provide some feedback (such as displaying a progress bar to show progress).
If generation is successful, the method returns True. There are may be some non-critical errors, though. You can control error handing using OnError event.
If you call Execute with UseThread = True, the method starts a background thread for report generation. Then it immediately exits, returning True. When generation is completed, OnGenerated event is called.
You must not call Execute while a report is being generated. In this case, Execute quickly finishes and returns False (and OnGenerated will not be called for this nested call of Execute).
If you generate a report in a background thread, or if you use Application.ProcessMessages, you must take the following measures:
1.Hide the TRichView control while a report is being generated, and show it only when finished. While generating, this TRichView is not ready for repainting, until you call its Format method.
2.Prevent the form closing while a report is being generated (check Generating in the form's OnCloseQuery event).
3.Prevent subsequent calls of Execute while a report is being generated.