• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

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.abstractDirectory#_print.html">
<hr>
</cfoutput>

any ideas?
TOPICS
Advanced techniques

Views

876

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

You need a cfcontent tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

LATEST
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">
<cfoutput query="getprinthtml">
<cfinclude template="/uploads/#getprinthtml.abstractDirectory#/#getprinthtml.abstractDirectory#_print.html">
<hr>
</cfoutput>
</cfsavecontent>

then use theBody 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 ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation