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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Office 2007 cfheader cfcontent Word docx problem

Status
Not open for further replies.

pixiesfb

Programmer
Apr 27, 2001
62
US

When we updated to Office 2007, we also needed to update cfheader and cfcontent tags to accommodate .docx and other 'x' extensions for our dynamically created documents.

Example:
<cfheader name="Content-Disposition" value="attachment:filename=myfile">
<cfcontent type="application/vnd.openxmlformats-officedocument.wordprocessingml.document">

This does open the document. However, when a user tries to save it, it defaults to .html extension instead of .docx. Any ideas?

---
Previously, tags looked like this:
<cfheader name="Content-Disposition" value="attachment:filename=myfile.doc">
<cfcontent type="application/vnd.msword">
---

 
Not sure if it is a typo, but it looks like you are missing the file extension .docx . Also, the value separator is a semi-colon, rather than a colon. ie

<cfheader name="Content-Disposition" value="attachment; filename=myfile.docx"> OR
<cfheader name="Content-Disposition" value="attachment; filename=""myfile.docx""">


----------------------------------
 
No extension needed in <cfheader name="Content-Disposition" value="attachment:filename=myfile">.
 
For .doc, yes. For .docx, no. Try both of these yourself and you will see that Word will not open the file if you put a .docx on the end of myfile in the second set of cfheader/cfcontent.

<cfheader name="Content-Disposition" value="attachment:filename=myfile.doc">
<cfcontent type="application/vnd.msword">

<cfheader name="Content-Disposition" value="attachment:filename=myfile">
<cfcontent type="application/vnd.openxmlformats-officedocument.wordprocessingml.document">




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top