User Guide

Table Of Contents
770 Chapter 32: Creating Reports for Printing
Saving printable reports in files
You can use the
cfdocument filename attribute to save the generated PDF or SWF output to a
file, as the following example shows:
<!--- 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 the ColdFusion MX 7 reporting
Macromedia ColdFusion MX 7 reporting adds integrated business reporting to ColdFusion,
providing access to important business data. ColdFusion MX 7 reporting consists of server-side
runtime processing and a graphical user interface (GUI), called the Report Builder.
For information on installing the Report Builder, see “Getting started” on page 775.
This section describes how to use the Report Builder to define report definitions. The Report
Builder is a Windows-only tool that lets you build banded reports. A banded report consists of
multiple horizontal sections (bands), one band for each part of a printed report. For example, data
and text in the report header band prints at the beginning of the report, data and text in the page
header band prints at the beginning of each page, and data and text in the page footer band prints
at the end of each page. In the middle of the report is the detail band, which, at runtime, contains
one row for each row in the reports result set or database query.