Adobe COLDFUSION 9 Manual page 1019

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<!--- The compasstravel database is part of the Getting Started
tutorial application, found under the cfdocs directory. --->
<cfquery datasource="compasstravel" name="compasstrips">
SELECT tripName, tripDescription, tripLocation, price
FROM trips
ORDER BY price
</cfquery>
<cfdocument format="pdf"
filename="#GetDirectoryFromPath(GetTemplatePath())#/compasstrips.pdf"
overwrite="yes">
<cfdocumentsection>
<h1 align="center">Compass Travel</h1>
<h2 align="center">Destination Guide</h2>
<p align="center"><img src="cfdocs/getting_started/photos/somewhere.jpg"></p>
</cfdocumentsection>
<cfdocumentsection>
<cfdocumentitem type="header">
<font size="-3"> <i>Compass Travel Trip Descriptions</i></font>
</cfdocumentitem>
<cfdocumentitem type="footer">
<font size="-3">
<cfoutput>Page #cfdocument.currentpagenumber#</cfoutput>
</font>
</cfdocumentitem>
<cfoutput query="compasstrips">
<hr>
<h2>#tripName#</h2>
<p><b>#tripLocation#</b></p>
<p>Price: #DollarFormat(price)#</p>
<p>#tripDescription#</p>
</cfoutput>
</cfdocumentsection>
</cfdocument>
Creating reports with Crystal Reports (Windows only)
When running on Windows, the cfreport tag also supports the execution of reports created using Crystal Reports
version 9 or 10.
Note: When you install Crystal Reports, select the Enable export to HTML and Enable export to Disk options. These
options are not enabled by default, so you must use the Custom Install option.
Create a report definition in Crystal Reports.
1
Create a CFM page and add a
2
example shows the
cfreport
<cfreport report = '/reports/monthlysales.rpt'>
{Departments.Department} = 'International'
</cfreport>
3
Open a browser and display the CFM page.
ColdFusion uses COM to call Craxdrt9.dll for Crystal Reports version 9, and Craxdrt.dll for Crystal Reports version
10. If you have problems with the
register them (the default location for these DLLs is C:\Program Files\Crystal Decisions\Report Designer Component\).
For complete information on defining reports in Crystal Reports, see the Crystal Reports documentation.
tag that invokes the Crystal Reports report definition. The following
cfreport
tag invoking a Crystal Reports report definition and passing a filter condition:
tag, ensure that these DLLs are registered and, if not, use regsvr32 to
cfreport
Last updated 8/5/2010
1014

Advertisement

Table of Contents
loading

Table of Contents