I'm using Coldfusion 8 and trying get it to export to Microsoft Word an RTF file that was also created in Word, and is stored on the server. The problem is that when Word opens from the browser, it displays the RTF code for the document as if I'd opened the file in a text editor. The extension is ".rtf", and I've tried using ".doc" and ".docx" but nothing works. And even though Word opens it with an rtf extension, if I do a "Save As", it wants to save the file as an .htm file. I've also tried changing the content-type to "application/msword" but this didn't work. Also if I use OpenOffice instead of MS Word it still doesn't work. My code is below, if anyone could tell me what I'm doing wrong it would be very appreciated.
<cfset formFile = "test.rtf">
<cfset pathToRTF = GetDirectoryFromPath(GetCurrentTemplatePath()) & formFile />
<!---<cfset rtfForm = FileRead(pathToRTF) />--->
<cfheader name="Content-Type" value="application/rtf">
<CFHEADER NAME="Content-Disposition" VALUE="filename=test.rtf">