Adobe ColdFusion 8

cfdocumentitem

描述

cfdocument标签创建的 PDF 或 FlashPaper文件指定 action items。 Action items 包括以下内容:

  • header
  • footer
  • pagebreak

类别

Data output tags数据输出标签

语法

<cfdocument ...>
    <cfdocumentitem
    type = "pagebreak|header|footer"
    header/footer text
    </cfdocumentitem>
</cfdocument>

注意: 你可以在属性选择框里面制定这个标签的属性,这个属性选择框本身是一个结构。在属性选择框里面指定属性的名字,并且使用标签的属性名作为结构的关键字。

属性

属性

必选 /可选

默认

描述

type

Required

 

指定 the action:

  • pagebreak: 在标签的 location打开一个新的页面。
  • header: 在<cfdocumentitem></cfdocumentitem> 标签之间是有文本,把文本作为running header.
  • footer: 在<cfdocumentitem></cfdocumentitem> 标签之间是有文本,把文本作为 running footer.

使用方法

使用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.totalsectionpagecountcfdocument.currentsectionpagenumber 范围变量的范例,请看 cfdocument.

你可以在cfdocumentsection标签里使用cfdocumentitem标签,也可以在cfdocumentsection标签外面使用cfdocumentitem标签,如下:

 
(没有cfdocumentsection的情况下,这个cfdocumentitem属性适用于整个文件,如下:)
  • If the tag is at the top of the document, it applies to the entire document. 如果这个标签在文件的顶端,它适用于整个文件。
  • If the tag is in the middle of the document, it applies to the rest of the document. 如果这个标签在文件的中部,那么它适用于所处位置的以下部分。
  • If the tag is at the end of the document, it has no affect. 如果这个标签在文件的底部,那么它就没有作用。
 
(在有cfdocumentsection标签的情况下 这个cfdocumentitem属性只适用于预先指定了 header and footer 规格的section 和 overrides。)

范例

<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>