Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output to WORD

Status
Not open for further replies.

NickyJay

Programmer
Sep 1, 2003
217
GB
Hi All,

im hoping someone can point me in the right direction here, i have followed the example of outputing to a word template from the web application kit (MX7 ver), and have managed to output to a .rtf file.

However, i wanted to be able to output to a .doc file as my text has fomatting and doesn't disply right in the .rtf - instead of showing bold text i get the <b></b> tags around the text! When i try to get it to output to a .doc file i get an error saying WORD cannot open the file, check permmissions of the file/check if enough disk space - both are ok!

Should i be trying to output to a .doc or trying something else to show the formatting of my intended document?

Thanks!
 
something like ...


<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfset tab=chr(9)>
<cfset carriage=chr(13)&chr(10)>

<cfcontent type="application/msword">
<cfheader name="Content-Disposition" value="filename=myFile.doc">
<cfoutput>
hi
this is my word document
created on #Now()#
</cfoutput>


hope it helps

 
Falconeeye is right, but I'd like to suggest changing:
Code:
<cfheader name="Content-Disposition" value="filename=myFile.doc">
to:
Code:
<cfheader name="Content-Disposition" value="attachment;filename=myFile.doc">

[plug=shameless]
[/plug]
 
I hope no one minds if I expand this thread some...

What are the advantages of the <cfheader> method? I use MS Word output in many places on my intranet application.

I use the following method for no other reason than it was the first example I ran across when the development task was at hand.

Code:
<cffile contentType='application/msword' 
 action='write' 
 file='#mFileName#'
 output = '#PrintData#'>
Any discussion appreciated.


Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top