2015-01-26 30 views
2

我与Coldfusion10工作,我面临着这样的错误:cfdocument问题 - cfdocument没有主体

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但仍然没有成功。我在这里错过了什么吗?

回答

1

确保你实际上是在结束。我假设你在这里错过了这个。

否则一切似乎都与Wiki Docs一致。

我会建议两件事。

  1. 确认您使用的是ColdFusion 11 Update 3. Update 3是一个重大更新,可能已解决此问题。
  2. 如果您正在使用更新3,在bugbase.adobe.com
0

打开一个错误,你在你的问题包括该错误消息表示,有你的<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