0

I have a report which is doing a page-break on a tfoot tag.

<style type="text/css">
@media print
{
tfoot{page-break-after:always}
}
</style>

The output comes from a query (here called "test"), ordered by state. The report is in a table and I want to break after each state. It's PAGING correctly. But the problem is that the first header (for the first state) precedes and the first footer (for the first state) follows each subsequent header and footer. In my test program I worked around it by inventing a blank state and setting its header and footer to blank. However, in my real program things are too complicated to do that; and I don't like kluges anyway. Can anyone tell me how to get that first header and footer to appear just once where they are supposed to be? Here is the test program:

<cfset statels = (" ,DE,NC,MD")> <!--- the blank state is the kluge --->
<cfset i = 0>

<table style = "margin-left: 50px">
<cfloop list = #statels# index = "state">
<cfset i = i + 1>

<cfoutput>   
<thead>
<cfif i EQ 1>
<tr><td>&nbsp </td></tr>
<cfelse>
<tr>      
<td style = "border:1px solid green">This is a Header #state#</td>
<td>  <img src="http://localhost/reports/XYZinc.jpg" alt="picture"> </td>
</tr> 

<!--- column headings to be on each page --->
<tr>   
<cfloop array = #test.GetColumnList()# index = "col">          
<td class = "repsort">#col#  </td>
</cfloop>       
</tr>        
</cfif>
</thead>  
</cfoutput>   

<cfoutput query = "test">
<cfif test["PersonState"][currentrow] EQ state>  
<tr>
<cfloop array = #test.GetColumnList()# index = "col">
<td>#test[col]currentrow]#  </td>
</cfloop>
</tr> 
</cfif><!--- personstate is state --->   
</cfoutput>  

 <cfoutput>  
 <tfoot>
 <cfif i EQ 1>
 <tr><td>&nbsp </td></tr>
 <cfelse>
 <tr>
 <td>This is a footer<br> i is #i# state is #state#  
 </td>
</tr>
</cfif>
</tfoot>    
</cfoutput> <!---query = test --->
</cfloop> <!--- i loop --->  
</table>
4

0 回答 0