|
Posted by strawberry on 07/31/06 09:54
strawberry wrote:
> Kimmo Laine wrote:
> > "strawberry" <zac.carey@gmail.com> wrote in message
> > news:1154080399.591498.91400@75g2000cwc.googlegroups.com...
> >
> > Kimmo Laine wrote:
> > > "strawberry" <zac.carey@gmail.com> wrote in message
> > > news:1154074574.791314.102370@i3g2000cwc.googlegroups.com...
> > > > I've written a (single-page) script that works like this;
> > > >
> > > > If no values are posted to it, the script creates a form page for a
> > > > user to fill in and 'submit'.
> > > >
> > > > If values are posted to it (i.e. the user filled in the form), the
> > > > script renders a page of html with the user-supplied values.
> > > >
> > > > Straightforward stuff, however, if values are posted I'd like the
> > > > rendered page to open in MS word for further editing, instead of the
> > > > users default browser.
> > > >
> > > > What steps can I take to acheve this?
> > >
> > >
> > > Make an .rtf-document. You can start by making a template in Wordpad or
> > > Word, save the file as rtf and open it, it's just plaintext. Copy it and
> > > paste it to your php file, then insert required php magic in the rtf (echo
> > > the user input values to right places) and finally make it look like rtf
> > > document with headers.
> > >
> > > header('Content-type: application/msword');
> > > header('Content-Disposition: attachment; filename="myfile.rtf"');
> > > header('Cache-Control: private');
> > >
> > > This is at least how I've managed to do it. The only hard part is the rtf
> > > which has quite messy markup.
> > >
> > >
> > > Thanks for the reply Kimmo,
> > >
> > > So, wouldn't this work - if it only appeared in the 'values posted'
> > > case?
> >
> >
> > As a wise man once said, "Well, duh!". I thought it was kinda obvious but
> > apparently it wasn't. Yes, only in the case if values are posted.
> >
> :-) That wasn't my question.
>
> I was referring to the substitution of '.rtf' with '.htm'.
>
> But thinking about it, that won't work will it, because it will trigger
> Word before the page is rendered? But perhaps if I set it up to preview
> the rendered page in a web browser with maybe an edit button that then
> sends the rendered page to Word?
>
> Does any of that make sense?
Anyway, I was wrong. I just substitued '.rtf' with '.htm' and it worked
fine. Somehow, I thought the php would be 'deactivated' because the
file was apparently triggering Word prior to the page being rendered,
but that wasn't the case.
Thanks again.
Navigation:
[Reply to this message]
|