Specifies action items for a PDF or FlashPaper document created by the cfdocument
tag. Actions include the following:
<cfdocument ...>Syntax 1
<cfdocumentitem type = "pagebreak"/>Syntax 2
<cfdocumentitem type = "header" or "footer">header/footer text
</cfdocumentitem> </cfdocument>
cfreport
,
cfdocument
, cfdocumentsection
ColdFusion MX 7: Added this tag.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
type |
Required |
|
Specifies the action:
|
Use the cfdocumentitem
tag to control the formatting of a PDF or FlashPaper report. This tag must be wrapped inside a <cfdocument>
</cfdocument>
pair.
Write code for one cfdocumentitem
tag for each pagebreak, running header, or running footer.
You can use the cfdocument scope variable, cfdocument.currentpagenumber, to display the current page number in a header or footer. You can also use cfdocument.totalpagecount to display the total number of pages. For example:
... <cfdocumentItem type= "footer> #cfdocument.currentpagenumber# of #cfdocument.totalpagecount# </cfdocumentitem>
You can use cfdocumentitem
tags with or without the cfdocumentsection tag, as follows:
Without cfdocumentsection The cfdocumentitem
attribute applies to the entire document, as follows:
With cfdocumentsection tags The cfdocumentitem
attribute applies only to the section and overrides previously specified header and footer specifications.
<cfquery datasource="cfdocexamples" name="parksQuery"> SELECT parkname, suptmgr from parks </cfquery> <cfdocument format="PDF"><cfdocumentitem type="header">National Parks Report</cfdocumentitem>
<!--- Use a footer with current page of totalpages format ---><cfdocumentitem type="footer">
<cfoutput>Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</cfoutput></cfdocumentitem>
<h1>Park list</h1> <table width="95%" border="2" cellspacing="2" cellpadding="2" > <tr > <th>Park</th> <th>Manager</th> </tr> <cfoutput query="parksQuery"> <tr> <td><font size="-1">#parkname#</font></td> <td><font size="-1">#suptmgr#</font></td> </tr> </cfoutput> </table> </cfdocument>