?
Solved

ColdFusion 5 - Make Word have the right filename

Posted on 2003-03-12
9
Medium Priority
?
252 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:curmudgeon42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 

Expert Comment

by:JonnyWeb
ID: 8119918
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
 

Author Comment

by:curmudgeon42
ID: 8119954
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
 

Expert Comment

by:JonnyWeb
ID: 8120152
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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:curmudgeon42
ID: 8139380
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
 

Expert Comment

by:DynAstY
ID: 8143777
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
 

Expert Comment

by:JonnyWeb
ID: 8479994
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
 

Accepted Solution

by:
DynAstY earned 200 total points
ID: 8480557
It works for me :)
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10940568
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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question