Click to See Complete Forum and Search --> : Converting text to word doc


linuxlewis
05-14-2007, 12:05 AM
Hi

I have a a project in which text is entered into a mysql database by users via forms using php on a linux server. I need the users to be able to download the data they have entered in various file formats including word doc. I don't know how to do this and haven't been able to find much out by googling. Is there software available for this, or can it be done through php? I'd appreciate it if someone could point me in the right direction.

Thanks,
SW

mrBen
05-14-2007, 04:54 AM
I very much doubt you would be able to do this with PHP. Turning text into .DOC is a complicated business......

However, take a look at this (http://applications.linux.com/article.pl?sid=07/04/27/2031208&tid=13) Linux.com article on using OpenOffice.org to do text conversion - it might be a usable solution.

cybertron
05-14-2007, 04:00 PM
You might also check out abiword. It can run conversions from the command-line and this article (http://opensource.weblogsinc.com/2005/06/29/use-abiword-to-convert-filetypes-on-the-command-line/) claims it will convert to Word.

Parcival
05-14-2007, 05:35 PM
I have a a project in which text is entered into a mysql database by users via forms using php on a linux server. I need the users to be able to download the data they have entered in various file formats including word doc.

It is possible to export the content of a mysql database as an Excel spreadsheet. Maybe you can work that into a Word file in some sort of helpful way.

linuxlewis
05-15-2007, 12:03 AM
Thanks all. I'll be looking into each of these suggestions. Appreciate it.

KingJorge
05-15-2007, 02:43 PM
Maybe I am wrong on this, but can't you just export the text with a .doc extension?

If my calculations are correct, It should open up in Word fine sans formatting.

linuxlewis
05-15-2007, 04:42 PM
Thanks for the reply KingJorge
You may be right about this, but I need it to be formatted. The application takes the form entries and assembles them into a resume, and is supposed to let the user download them in various formats-word, pdf, text, etc. I already have it formated in html, so if can convert it from that to pdf and doc and retain the formatting, I think I would be pretty well set. Right now I'm looking into using abiword from the command line.

DjDx
05-15-2007, 07:28 PM
It is possible to export the content of a mysql database as an Excel spreadsheet. Maybe you can work that into a Word file in some sort of helpful way.

the DB is converted to a CSV (Comma-Separated Values), which can be read by Excel...

To convert to .doc? Maybe try to convert to .RTF... May not give you all the flexibility of .DOC, but will still gives you basic formating... How do to it is unknown to me, but it could be possible... Using OpenOffice could be another option, but then again, I have no idea how to do it (I didn't read the link mrBen posted tho...).

To convert to pdf would probably be easier... maybe there is a way to "print to pdf" on the server side, then send the file to the client.