首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cfdocument问题- cfdocument没有正文

cfdocument问题- cfdocument没有正文
EN

Stack Overflow用户
提问于 2015-01-27 06:58:06
回答 2查看 887关注 0票数 3

我正在使用Coldfusion10,并且遇到了这个错误:

代码语言:javascript
复制
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没有在顶部或任何地方定义,这可能会导致这个问题,我将其用作

代码语言:javascript
复制
<cfdocument format="pdf">
<cfdocumentsection>
<cfdocumentitem  type="header"></cfdocumentitem> - Footer is used too 
</cfdocumentsection>

我试过使用evalAtPrint= true,但仍然没有成功。我是不是漏掉了什么?

EN

回答 2

Stack Overflow用户

发布于 2015-01-27 07:15:29

确保你实际上是在最后投篮。我猜你只是错过了这里。

除此之外,一切似乎都与Wiki Docs保持一致。

我会建议两件事。

  1. 验证您是否正在使用ColdFusion 11更新3。更新3是一个重大更新,可能已解决此问题。
  2. 如果您使用的是更新3,请在ColdFusion上打开一个错误
票数 1
EN

Stack Overflow用户

发布于 2015-01-27 21:13:18

问题中包含的错误消息表明<cfdocument>标记之间没有内容。您包含的代码证实了这一点。如果这不是您的实际代码,那么我们不能提供太多帮助。

您需要在<cfdocument>标签之间包含要转换为PDF的内容。你需要这样的东西:

代码语言:javascript
复制
<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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28160306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档