Copy link to clipboard
Copied
I am having a heck of a time trying to work with page breaks using <cfdocument>. I have a query that I loop over and it generates some html <table> with data from the query in the html <td>'s. The problem is the page just breaks off and continues on the next page, it essentially just cuts my table wherever the page break occurs.
I have tried css, adjusting the margins, cfdocumentitem pagebreak, etc...to no avail.
I am using version 8,0,0,176276
Any suggestion would be greatly appreciated.
Hey There,
Try something like this:
Repeat additional page code below to cover the query output. You can
add enough additional page code to account for future output data. Like
if current output requires 5 pages, you could code for 8 pages, giving you
a 3 page buffer before having to add more additional page code.
Leonard B
<=== Code below ===>
<cfdocument>
<table>
<tbody>
<cfoutput query="qname" maxrows="[enter max rows to display per page]" startrow="1">
<tr>
<td>
<!--- Insert output --->
</td>
<
Copy link to clipboard
Copied
Hey There,
Try something like this:
Repeat additional page code below to cover the query output. You can
add enough additional page code to account for future output data. Like
if current output requires 5 pages, you could code for 8 pages, giving you
a 3 page buffer before having to add more additional page code.
Leonard B
<=== Code below ===>
<cfdocument>
<table>
<tbody>
<cfoutput query="qname" maxrows="[enter max rows to display per page]" startrow="1">
<tr>
<td>
<!--- Insert output --->
</td>
</tr>
</cfoutput>
</tbody>
</table>
<!--- Additional page (2) --->
<cfif qname.recordcount gt 25>
<cfdocumentitem type="pagebreak" />
<table>
<tbody>
<cfoutput query="qname" maxrows="[enter max rows to display per page]" startrow="[enter start row for page]">
<tr>
<td>
<!--- Insert output --->
</td>
</tr>
</cfoutput>
</tbody>
</table>
</cfif>
<!--- Additional page (3) --->
<cfif qname.recordcount gt 50>
<cfdocumentitem type="pagebreak" />
<table>
<tbody>
<cfoutput query="qname" maxrows="[enter max rows to display per page]" startrow="[enter start row for page]">
<tr>
<td>
<!--- Insert output --->
</td>
</tr>
</cfoutput>
</tbody>
</table>
</cfif>
</cfdocument>
Copy link to clipboard
Copied
Thank you for responding so quickly. I did what you suggested, but the pagebreak is not working as intended, instead it creates a gap (about 3 lines) between output queries.
Thanks...
Copy link to clipboard
Copied
Mystery solved...I enclosed the output query in cfdocumentsection
& the pagebreak is now working.Thanks again!