我正在使用Coldfusion10,并且遇到了这个错误:
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
cfdocument tag has no body.
It must have a body or a source file or URL.我检查了网站,发现cfsettings没有在顶部或任何地方定义,这可能会导致这个问题,我将其用作
<cfdocument format="pdf">
<cfdocumentsection>
<cfdocumentitem type="header"></cfdocumentitem> - Footer is used too
</cfdocumentsection>我试过使用evalAtPrint= true,但仍然没有成功。我是不是漏掉了什么?
发布于 2015-01-27 07:15:29
确保你实际上是在最后投篮。我猜你只是错过了这里。
除此之外,一切似乎都与Wiki Docs保持一致。
我会建议两件事。
发布于 2015-01-27 21:13:18
问题中包含的错误消息表明<cfdocument>标记之间没有内容。您包含的代码证实了这一点。如果这不是您的实际代码,那么我们不能提供太多帮助。
您需要在<cfdocument>标签之间包含要转换为PDF的内容。你需要这样的东西:
<cfquery datasource="cfdocexamples" name="empSalary">
SELECT Emp_ID, firstname, lastname, e.dept_id, salary, d.dept_name
FROM employee e, departmt d
WHERE e.dept_id = d.dept_id
ORDER BY d.dept_name
</cfquery>
<cfdocument format="PDF">
<cfoutput query="empSalary" group="dept_id">
<cfdocumentsection>
<cfdocumentitem type="header">
<font size="-3"><i>Salary Report</i></font>
</cfdocumentitem>
<cfdocumentitem type="footer">
<font size="-3">Page #cfdocument.currentpagenumber#</font>
</cfdocumentitem>
<h2>#dept_name#</h2>
<table width="95%" border="2" cellspacing="2" cellpadding="2" >
<tr>
<th>Employee</th>
<th>Salary</th>
</tr>
<cfset deptTotal = 0 >
<!--- inner cfoutput --->
<cfoutput>
<tr>
<td>
<font size="-1">#empSalary.lastname#, #empSalary.firstname#</font>
</td>
<td align="right">
<font size="-1">#DollarFormat(empSalary.salary)#</font>
</td>
</tr>
<cfset deptTotal = deptTotal + empSalary.salary>
</cfoutput>
<tr>
<td align="right"><font size="-1">Total</font></td>
<td align="right"><font size="-1">#DollarFormat(deptTotal)#</font></td>
</tr>
<cfset deptTotal = 0>
</table>
</cfdocumentsection>
</cfoutput>
</cfdocument>Copied from the ColdFusion documentation here
https://stackoverflow.com/questions/28160306
复制相似问题