为cfdocument标签创建的 PDF 或 FlashPaper文件指定 action items。 Action items 包括以下内容:
Data output tags数据输出标签
<cfdocument ...>
<cfdocumentitem
type = "pagebreak|header|footer"
header/footer text
</cfdocumentitem>
</cfdocument>
|
属性 |
必选 /可选 |
默认 |
描述 |
|---|---|---|---|
|
type |
Required |
|
指定 the action:
|
使用cfdocumentitem标签来控制PDF 或 FlashPaper 报表 的 formatting 。这个标签必须包裹在 <cfdocument>和 </cfdocument> 之间。
在一个cfdocumentitem标签里为每一个 page break, running header, 或 running footer写代码。
ColdFusion 8 在cfdocumentitem标签里为cfdocument范围变量添加了支持。你可以使用 cfdocument范围变量 , cfdocument.currentpagenumber, 在一个header或footer里显示当前页面的数量。你还可以使用cfdocument.totalpagecount 来显示全部的页面数量,比如说:
... <cfdocumentitem type= "footer> #cfdocument.currentpagenumber# of #cfdocument.totalpagecount# </cfdocumentitem>
举个使用 cfdocument.totalsectionpagecount 和 cfdocument.currentsectionpagenumber 范围变量的范例,请看 cfdocument.
你可以在cfdocumentsection标签里使用cfdocumentitem标签,也可以在cfdocumentsection标签外面使用cfdocumentitem标签,如下:
<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>