Your application can invoke a report by displaying the CFR file in a browser or by displaying a CFM page whose cfreport tag invokes the report.
You can optionally use the cfreport
tag to save the report to a file.
The cfreport
tag supports advanced PDF encryption options. For more information, see CFML Reference and Using advanced PDF options.
For information on report preview, see Previewing reports.
cfreport
tag that invokes the report. If the report does not use an internal query, you must also populate a query and pass it using the query
attribute. If the report uses an internal query and you use the query
attribute, the passed query overrides the internal query.
<cfquery name="northwindemployees" datasource="localnorthwind"> SELECT EmployeeID, LastName, FirstName, Title, City, Region, Country FROM Employees ORDER BY Country, City </cfquery> <CFREPORT format="PDF" template="EmpReport.cfr" query="#northwindemployees#" />
ColdFusion MX generates the report.
Tip: ColdFusion MX does not render text that occurs before or after the cfreport
tag.
ColdFusion MX generates the report.
cfreport
tag that invokes the report. Optionally pass a query
attribute, as described in the previous procedure. Include a filename
attribute that specifies the fully qualified name of the file to be created, as the following example shows:
<CFREPORT format="PDF" template="emppicture.cfr" filename="#GetDirectoryFromPath(GetTemplatePath())#/emppicture.pdf" overwrite="yes"/>
Tip: Use the .pdf extension for PDF output format, the .swf extension for FlashPaper output format, and the .xls extension for Excel format.
ColdFusion MX generates the report, saves the file, and displays an empty page.