问题描述
我在ColdFusion中创建了一个动态PDF,并且遇到了pagebreak的问题。有问题的页面可以有1条记录,或最多60条记录。每个记录显示在表的2行中。一些返回的记录在页面之间分割(第一行在第一页的结尾,第二行是下一行的顶行)。
I am creating a dynamic PDF in ColdFusion and having an issue with "pagebreak". The page in question could have 1 record, or up to 60+ records. Each record is displayed in 2 rows of a table. Some of the returned records are being split between pages (first row is at the end of page one, the second row is the top row of the next).
显示的HTML中的示例记录:
A sample record in displayed HTML:
<tr>
<td>Title</td><td>Price</td>
<td colspan="2">Description</td>
</tr>
每个客户端请求,我试图显示=每页9条记录。
这里是我试过的一个例子:
Here is a dumbed down sample of something I have tried:
<cfdocument format="PDF">
<cfoutput query = "sqllookup">
<cfset loopcount = loopcount + 1>
<cfif loopcount EQ '9'>
<cfdocumentitem type="pagebreak" />
<cfelse>
<tr>
<td>#Title#</td><td>#Price#</td>
<td colspan="2">#Description#</td>
</tr>
</cfif>
</cfoutput>
</cfdocument>
这不起作用,(只隐藏第9条记录)。我试过几个不同的想法,我目前的困惑。我在寻找东西吗?
This does not work, (it only hides the 9th record). I have tried several different ideas, and I am currently stumped. Am I over looking something?
提前感谢。
ColdFusion MX 7.
(我还运行了文本截断问题的修复程序。)
推荐答案
第9条记录,因为您选择显示它并显示它:
You are hiding the 9th record because you are choosing between displaying it and showing it:
if 9th record
break page
else
show record
end if
你想要的是更多: / p>
What you want is more like:
<cfoutput query = "sqllookup">
<!--- this is the 9th row, because 9 mod 9 is 0 --->
<cfif not sqllookup.currentrow mod 9>
<cfdocumentitem type="pagebreak" />
</cfif>
<tr>
<td>#Title#</td><td>#Price#</td>
<td colspan="2">#Description#</td>
</tr>
</cfoutput>
这篇关于COLDFUSION:cfdocument和强制分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!