1 Reply Latest reply on May 23, 2014 2:35 PM by gordon va

    CF 10 cfcontent application/msword displays HTML code instead of document?

    gordon va

      I have this code for a generic template:

         <cfset fileName="c:\temp\wordTmpDoc"&randRange(1,100000)&".htm">

          <cfif fileExists(fileName)><cffile action="delete" file="#fileName#"></cfif>

          <cfsavecontent variable="htm"><CFINCLUDE template="#incl#.cfm"></cfsavecontent>

          <cffile action="write" file="#fileName#" output="#htm#">

          <cfcontent file="#fileName#" deletefile="no" type="application/msword">

      Note the CFINCLUDE. I also have another template that goes through generating the html in a cfsavecontent and at the bottom it has essentially the same code but uses the HTML generated on the page as the content for the document. The above generic version brings up MS Word but the content is the HTML code, while the page that has local cfsavecontent wrapping the HTML, the document displays properly.