2015-01-26 57 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