Thanks Adam.  Will have a go at it today.

Brian

> -----Original Message-----
> From: Adam Cameron [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, 1 September 2004 14:44
> To:   CFAussie Mailing List
> Subject:      [cfaussie] Re: Using the cfcontent tag.
> 
> > Adam,
> >     I need to take HTML form and take those form field to populate a
> > word document that the user can then print.  I'm using a CF page to red
> in
> > the template document (RTF) file and then replace placeholders with the
> form
> > data.  I then use the cfcontent tag to allow the user to print of save
> the
> > resulting word document.  
> 
> Oh.
> 
> So you want to do this:
> 1) create the world doc
> 2) use <cfcontent> to deliver to the browser as an attachment so they can
> save it (NOT display it).
> 3) go somewhere else after they save it.
> 
> I see.
> 
> Do this:
> 
> <!--- resultPage.cfm --->
> <cfheader name="refresh" value="2;url=./downloadPage.cfm">
> This is the final destination
> 
> <!--- downloadPage.cfm --->
> <!--- This is the page that generates the Word document, saving it as
> /worddata.txt--->
> <cfheader name="content-disposition" value="attachment;filename=test.doc">
> <cfcontent type="application/msword" file="/worddata.txt">
> 
> Browse to resultPage.cfm.
> 
> Now, the thing is you're doing things the reverse of what you think you
> might.  There's no way of getting around the two requests issue... you
> can't do it in one hit.  But you can make it look like you're doing it in
> one hit.
> 
> What you do is go to the URL in step (3) first.  At the top of that, you
> have a redirect to the URL in step (2).  Because <cfheader>/<cfcontent>
> sets that to be an attached Word doc, it doesn't affect the on-screen
> browser display, and all you get is the file download pop-up.  I'm
> guessing
> some browser settings might block the redirect, hence you'll see most
> sites
> that do this present a link saying "if you're download doesn't start
> immediately, click here".  That link would go to the URL in step (2).
> 
> Does that sort your situation out?
> 
> Adam
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/


-----------------------------------------------------------------------------------
This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related 
entities ("Suncorp"). 

Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 1800 689 762 
or at suncorp.com.au.

The content of this e-mail is the view of the sender or stated author and does not 
necessarily reflect the view of Suncorp. The content, including attachments, is a 
confidential communication between Suncorp and the intended recipient. If you are not 
the intended recipient, any use, interference with, disclosure or copying of this 
e-mail, including attachments, is unauthorised and expressly prohibited. If you have 
received this e-mail in error please contact the sender immediately and delete the 
e-mail and any attachments from your system.

If this e-mail constitutes a commercial message of a type that you no longer wish to 
receive please reply to this e-mail by typing Unsubscribe in the subject line.


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to