Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / March 2007



Tip: Looking for answers? Try searching our database.

cfinclude within cfoutput or cfloop won't work when trying to create a doc using cfheader

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
loucas - 30 Mar 2007 10:17 GMT
am trying to create a word document by using the following code (see below).
The doc does get created but with only the first record.

Have tried using cfloop instead of cfoutput and it does the same thing.

When i comment out the cfheader tag the results are displayed without any
problem.

<cfquery name="getprinthtml" datasource="#dsn#">
SELECT     abstractDirectory
FROM         Abstract_tbl
WHERE     (Abstract_ID IN (#url.abslist#))
</cfquery>

<cfheader name="Content-Disposition" value="attachment; filename=AbsList.doc">

<cfoutput query="getprinthtml" startrow="1"
maxrows="#getprinthtml.recordcount#">
<cfinclude
template="/uploads/#getprinthtml.abstractDirectory#/#getprinthtml.abstractDirect
ory#_print.html">
[HR]
</cfoutput>

any ideas?
Dan Bracuk - 30 Mar 2007 13:23 GMT
You need a cfcontent tag.
loucas - 30 Mar 2007 14:21 GMT
have tried that as well and it still only goes as far as the first record.....

this is something that goes back as far as 2003

see link below

http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:28668
SafariTECH - 30 Mar 2007 21:46 GMT
You could probably generate the content of the end file separately, before
including it in the final file to be accessed by the user.

You could do this using CFSAVECONTENT

<cfquery name="getprinthtml" datasource="#dsn#">
SELECT abstractDirectory
FROM Abstract_tbl
WHERE (Abstract_ID IN (#url.abslist#))
</cfquery>

<cfsavecontent variable="theBody">
<cfinclude
template="/uploads/#getprinthtml.abstractDirectory#/#getprinthtml.abstractDirect
ory#_print.html">
[HR]
</cfsavecontent>

then use [b]theBody[/b] as a variable containing the entire contents at one
time when you generate the final Word doc so it does not have to run any
looping at that time.

Other than that, is there any chance the query is really only picking up one
row based on the cirteria ?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.