gpt4 book ai didi

coldfusion - 如何在每 4 条记录后在 cfdocument 中插入一个分页符

转载 作者:行者123 更新时间:2023-12-03 18:54:52 30 4
gpt4 key购买 nike

我有以下 cfdocument 代码:

<cfdocument format="pdf" orientation = "landscape" bookmark="Yes" marginleft=".25" marginright=".25" marginTop = ".75" marginbottom=".75" scale="90" localUrl="yes"> 
<cfoutput>
<cfdocumentsection name="Summary Page" marginleft=".25" marginright=".25" marginTop = "1.65" marginbottom="1" >
<cfdocumentitem type="header">
<center>
<table width="1000" height="200" cellpadding="3" cellspacing="0">
<tr><td>Header Page</td></tr>
</table>
</center>
</cfdocumentitem>

<cfloop query="first_query">
<cfquery name="getDetails" dbtype="query">
select * from first_query
where type= <cfqueryparam cfsqltype="cf_sql_varchar" value="#Type#">
</cfquery>

<cfsavecontent variable="trhead">
<tr class="bigbluecolor" style="text-align:center;">
<td width="6%">Term</td<
</tr>
</cfsavecontent>
#trhead#
<cfloop query="getDetails">
<tr align="center">
<td width="6%">#Listfirst(TermYears,'.')# Years</td>
</tr>
<cfif getDetails.recordcount GT 6 AND getDetails.currentRow EQ 6>
<cfdocumentitem type="pagebreak"/>
#trhead#
</cfif>
</cfloop>
</table>
</td></tr></table>
</cfloop>
</cfoutput>
</cfdocumentsection>
</cfdocument>

但是,它不会进行分页。它在顶部显示空白页面,然后它开始在任何它想要的地方打破。我希望我的内部循环在 4 条记录和 <TH> 后中断header 在第二页的开头再次重复。
trhead变量包含我用 savecontent 包装的代码显示它。

谁能解释我缺少什么?

最佳答案

分页符的不可预测性是因为:

<cfif getDetails.recordcount GT 6 AND getDetails.currentRow EQ 6>

如果 getDetails 的记录少于 6 条,则该条件将永远不会返回 true。另外,如果您有 12 条或更多记录,则不会返回 true。我建议这种方法。首先,将其添加到 first_query:
order by type

然后像这样构建你的内容:
<cfsavecontent variable="trhead">
<tr class="bigbluecolor" style="text-align:center;">
<td width="6%">Term</td>
</tr>
</cfsavecontent>

<cfoutput query="first_query">
other content goes here
<cfif currentRow mod 6 is 0>
<cfdocumentitem type="pagebreak"/>
#trhead#
</cfif>
</cfoutput>

关于coldfusion - 如何在每 4 条记录后在 cfdocument 中插入一个分页符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37228298/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com