You are here: Re: ,php to .htm to ms word « PHP Programming Language « IT news, forums, messages
Re: ,php to .htm to ms word

Posted by strawberry on 07/28/06 09:53

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.
>
> --
> "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
> http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
> spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)

Thanks for the reply Kimmo,

So, wouldn't this work - if it only appeared in the 'values posted'
case?

header('Content-type: application/msword');
header('Content-Disposition: attachment; filename="myfile.htm"');
header('Cache-Control: private');

thus avoiding all the messy stuff - I should add the html in the script
was originally derived from a Word template.

Cheers

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация