I am pulling out data from a DB that has HTML tagging around it since it comes from a GUI text editor, CKeditor to be specific (not that it really matters).
I first use this to build a PDF which is no problem.
Now I need to use this data to build a word document. What I am doing is using an .rtf document as the template since I have my headers and footers in there. Then in the .rtf template I have each of my variables to populate in there as %variableName%
I can't seem to format the text properly before this goes into the .rtf document and the HTML just becomes plain text and is entered that way.
Here is the code I am using. But I need to have a good way of formatting the data which has HTML tagging around it before it is populated into the .rtf template:
<cfset pathToRTF = GetDirectoryFromPath(GetCurrentTemplatePath()) & "MyTemplate.rtf" />
<cfset rtf = FileRead(pathToRTF) />
<cfset rtf = Replace(rtf,"%title%",title) />
<cfset rtf = Replace(rtf,"%variableName1%",variableName1) />
<cfset rtf = Replace(rtf,"%variableName2%",variableName2) />
<cfset rtf = Replace(rtf,"%variableName3%",variableName3) />
<cfheader name="content-disposition" value="filename=MyNewDocument.doc" />
Any help appreciated.