RTF is the way to go.

If you know what you want your word doc to look like, set it up in Word, or
whatever will save a formatted rtf file (Sorry, I'm Windows/Mac based, but I
presume that Open Office  etc will do this on Linux).

I insert placeholders into the document where I want to put dynamic data I
use %_varname_% to avoid any RTF conflicts.

In php, read the file into a string and str_replace() or preg_replace() the
placeholders for your data. Save the target file as *.doc and there you go -
done.

George

> -----Original Message-----
> From: dorgon [mailto:[EMAIL PROTECTED]
> Sent: 25 June 2003 9:06 am
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: generate word docs
>
>
> hmm... sounds troublesome.
> do you need all text/paragraph formatting features of word? what if
> finding a spec for RTF, which is much easier and specifying the word
> MIME key respectifely saving as .doc (words opens rtf without a convert
> dialog I think).
>
> just a thought
>
> Evan Nemerson wrote:
> > Summary: I have to create a word document on the fly. what's
> the best way to
> > go about it?
> >
> > Okay so I have a client that would like something output to a
> word document. I
> > already have HTML and PDF versions... I'm trying to figure out
> the best way
> > to do this. I am already aware of the open html in word hack.
> The way I see
> > it, these are my choices:
> >
> > 1)  Use the hack that I'm really don't like. It never looks
> quite right (which
> > is the whole point of this).
> > 2)  Move everything over to a windows host and use COM.
> > 3)  Somehow convice host (hurricane electric) to run PHP5 CVS
> w/ Sterling's
> > mono extension, and use .net to create the word document (does
> mono support
> > that class yet?). I hate C#. VB is even worse.
> > 4)  Find an open-source library that writes word documents
> (quick search
> > revealed nothing...), write an extension for php.
> > 5)  Find a spec for word docs and write a library in php
> > 6)  find a spec and write a library in c, then create php
> extension. I'm
> > willing to do this, but it would take a long time...
> > 7)  Tell my boss to sod off (politely, though), it's not
> currently feasible...
> > I think this is what he's expecting, anyways.
> >
> > So, does anyone have any suggestions/comments? Anyone know
> where I could find
> > a library (in c or php) or a spec? I'm kinda thinking aloud here hoping
> > someone will prod me in the right direction...
> >
> > Thanks
> > Evan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to