Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1015

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<cfdocument format="PDF">
<!--- Running header --->
<cfdocumentitem type="header">
<font size="-3"><i>Directory Report</i></font>
</cfdocumentitem>
<h3>cfdirectory Example</h3>
<!--- Use cfdirectory to display directories by name and size --->
<cfdirectory
directory="#GetDirectoryFromPath(GetTemplatePath())#"
name="myDirectory" recurse="yes"
sort="directory ASC, name ASC, size DESC">
<!---- Output the contents of the cfdirectory as a cftable ----->
<cftable query="myDirectory"
htmltable colheaders>
<cfcol header="DIRECTORY:" text="#directory#">
<cfcol header="NAME:" text="#Name#">
<cfcol header="SIZE:" text="#Size#">
</cftable>
</cfdocument>
The cfdocumentsection tag
When using
cfdocumentsection
ColdFusion ignores HTML and CFML outside
specified in previous sections or in the parent
the parent
tag control the units; the default for the unit attribute is inches.
cfdocument
Within a section, use the
cfdocumentitem
before each section, as the following example shows:
<cfquery datasource="cfdocexamples" name="empSalary">
SELECT Emp_ID, firstname, lastname, e.dept_id, salary, d.dept_name
FROM employee e, departmt d
WHERE e.dept_id = d.dept_id
ORDER BY d.dept_name
</cfquery>
<cfdocument format="PDF">
<cfoutput query="empSalary" group="dept_id">
<cfdocumentsection>
<cfdocumentitem type="header">
<font size="-3"><i>Salary Report</i></font>
</cfdocumentitem>
<cfdocumentitem type="footer">
<font size="-3">Page #cfdocument.currentpagenumber#</font>
</cfdocumentitem>
<h2>#dept_name#</h2>
<table width="95%" border="2" cellspacing="2" cellpadding="2" >
<tr>
<th>Employee</th>
<th>Salary</th>
</tr>
<cfset deptTotal = 0 >
<!--- inner cfoutput --->
, all text in the document must be enclosed within
cfdocumentsection
tag. If you specify margin attributes, the unit attribute of
cfdocument
tag to specify unique headers and footers for each section and a page break
Last updated 1/20/2012
cfdocumentsection
tags. The margin attributes override margins
1010
tags.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents