我正在生成一个报告,其中包含许多不同的表格来显示不同的数据集。通常表格会流入第二页或第三页,有谁知道如何使表格标题重复?
我无法使用记录计数来确定何时插入标题信息,因为数据是随机长度的,因此带有包装文本的记录可能会占用页面上的 10 行。我尝试将表头存储为变量并使用 ,但它会在每一页的顶部显示最后一个表的标题。
下面是一些示例代码来说明问题:
<cfoutput>
<cfdocument format="PDF" name="TestDetailReport" marginBottom = "1" marginLeft = ".3" marginRight = ".3" marginTop = ".5" orientation="landscape">
<cfdocumentsection name = "TA Overview" >
<cfdocumentitem type = "header">
<table width="100%">
<tr>
<td width="40%">Generated by:</td>
<td width="60%" align="left">cfdocumentitem type = "header"</td>
</tr>
</table>
</cfdocumentitem>
<!--- There will be several sections like this, each with thier own header --->
<body style="margin: 0px">
<table style="width:100%;">
<!-- table header to be repeated on each PDF page -->
<thead align="left" style="display: table-header-group">
<tr>
<td colspan="2" style=" text-align:center;color:red">Make the header of this section repeat when the table goes into the next page</td>
</tr>
<tr>
<td style="text-align:center;color:red">Row Number</td>
<td style="text-align:center;color:red">This column contains text of random length</td>
</tr>
</thead>
<!-- table body -->
<tbody>
<cfloop from="1" to="50" index="Index">
<tr style="border-bottom:thin;">
<td>Row #Index#</td>
<td><cfloop from="0" to="#RandRange(1, 50)#" index="randomText">#Index# blah </cfloop></td>
</tr>
</cfloop>
</tbody>
</table>
</body>
<cfdocumentitem type = "footer">
<table width="100%">
<tr>
<td width="12%">Generated by:</td>
<td width="13%" align="left">#cgi.auth_user#</td>
<td width="50%" rowspan="3" align="left">img src="file:///#ExpandPath('logo.gif')#"</td>
<td width="25%" rowspan="3" align="justify">Printed Copy as Part of Prepbook is a Controlled Document. All Other Copies are Uncontrolled.</td>
</tr>
<tr>
<td>Date:</td>
<td align="left">#DateFormat(now(), "medium")#</td>
<!--- <td align="right"></td> --->
</tr>
<tr>
<td>Page:</td>
<td align="left">#cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</td>
<!--- <td align="right"></td> --->
</tr>
</table>
</cfdocumentitem>
</cfdocumentsection>
</cfdocument>