cfloop with Cfheader and Cfcontent

Posted on 2005-05-04
Last Modified: 2013-12-24
I'm trying to use cfloop with cfheader and cfcontent inside the loop so to that I can produce multiple excel output files with a recordset variable name.

It seems like the cfheader statement is only recognized the first time through the loop.

Do anyone have any suggestions or other tags to use.

Question by:dmarnlo
    1 Comment
    LVL 35

    Accepted Solution

    You can not do this on the same page.  You can only send cfheader once per page.  That sets the header of the page.

    A better way to do what you want is to have a first page that has links to each of the files.  Then each link creates ONE file.

    <a href="Report.cfm?ID=1">Report 1</a>
    <a href="Report.cfm?ID=2">Report 2</a>
    <a href="Report.cfm?ID=3">Report 3</a>
    <a href="Report.cfm?ID=4">Report 4</a>

    (the above can be created dunamically with the cfloop)

    Then the report page generates one report based on the ID sent in.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now