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 ?