ColdFusion 5 - Make Word have the right filename

I have a page that displays an invoice in MS-Word inside the IE Browser.  This all works fine, I use CFCONTENT to tell the browser to open the word app.  However, while you are in Word-in-a-browser, if the user goes to File->Save As..., the suggested filename and default directory are useless.

Is there a way, using CFHEADER or something, to suggest the correct filename to Word?  Note that I am using IE6.  Some people are using Word 2000 and some people are using Word XP.  Although a solution for Word XP is more important.

Thanks,

Justin
curmudgeon42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JonnyWebCommented:
It is a matter of the url requesting the page. See below. An example of one page linking to another that serves up the file. The url string after the cfm defines the file save name.
##Link to the CF file serving up the file ## INDEX.CFM ##
<a href="GetFile.cfm/coolfile.zip">Click Here</a>
## /INDEX.CFM ##


##Serve up the file ## GetFile.cfm ##
<cfcontent type="application/zip"
file="#GetDirectoryFromPath(GetBaseTemplatePath())#coolfile.zip"
deletefile="No">
## /GetFile.cfm ##
0
curmudgeon42Author Commented:
We aren't loading a file from the server hard drive.  We are building the file dynamically and telling IE that the incoming file should be loaded in Word.
0
JonnyWebCommented:
I say again. It is a matter of the url requesting the file. Here is another example. To get the file to save as "myworddoc.doc" link to the file like this:


"<a href="servitup.cfm/myworddoc.doc">LINK</a>"


ServeItUp.cfm creates the word doc and when you save it word looks at the url and the last file name it sees is the "myworddoc.doc", and it saves it as "myworddoc.doc".
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

curmudgeon42Author Commented:
that doesn't work - eventually i had to write the HTML (destined for Word) to a file and then do a CFLOCATION to the file so that it would have the right filename - i then later had to put some code which would look for these old temp files and take care of them
0
DynAstYCommented:
Try this:

Run your query or do whatever to build output.

Then add these lines:
<cfheader name="Content-Disposition" value="attachment; filename=""WORDOUTPUT.doc""">
<cfcontent type="application/msword">

Then write you output normally using <CFOUTPUT> or whatever.

The browser should ask you to OPEN/SAVE document. This works in multi user environments also.
0
JonnyWebCommented:
DynAstY that header is new to me. curmudgeon42, does that work. I think it is the answer. I know I can use it. Thanks DynAstY.
0
DynAstYCommented:
It works for me :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrichmonCommented:
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation in the Cleanup topic area:

Accept DYnAstY

Please leave any comments here within the next four days.

mrichmon
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.