Reports are generally executed via the ReportInterface.ExecuteReport method which takes a TReportSetupMode parameter:
procedure ExecuteReport(AReportWriter: TReportWriter; ASetupMode: TReportSetupMode = smSetup;
AFormatIndex: Integer = 0; AReportTag: Integer = 0);
The default SetupMode is smSetup which presents the setup form as a pre-report prompt. A variation on this default is smSetupRepeat which returns the user to the setup form after a report has been generated (so another report can be generated immediately) and continues to do so until the user <Cancels>.
A report is sent directly to preview by using the SetupMode smPreview:
procedure TForm1.Button1Click(Sender: TObject);
begin
ReportInterface1.ExecuteReport(ReportWriter1, smPreview);
end;
The general SetupModes are:
smSetupRepeat | to setup prompt, repeated until user cancels |
smSetup | to setup prompt |
smPreview | direct to preview |
smPrint | direct to printer |
smVoid | setup cancelled, or no output beyond temp file |
To output a report directly to one of the available export formats, use one of the file format modes:
smPDFFile | direct to PDF file |
smHTMLFile | direct to HTML file |
smXMLFile | direct to XML file |
smODTFile | direct to ODT file |
smVPEFile | direct to VPE file |
smCustomFile | direct to custom format file |
Custom file formats (smCustomFile) represent any other file format you wish to implement through the reporting system (such as TXT, XLS, CSV etc). These format options are qualified and identified by the additional integer parameter AFormatIndex passed to the ExecuteReport method.
Each of the file modes has an equivalent email option. This allows the respective file to be emailed as an attachment.
smEmailPDFFile | direct to PDF file email |
smEmailHTMLFile | direct to HTML file email |
smEmailXMLFile | direct to XML file email |
smEmailODTFile | direct to ODT file email |
smEmailVPEFile | direct to VPE file email |
smEmailCustomFile | direct to custom format file email |
The final parameter of the ExecuteReport method is AReportTag. This is an optional integer tag that can be used to identify a report throughout its generation process, or to pass formatting information etc. Access the tag via the ReportWriter.ReportTag property.