PHP to MSWord?

Discussion in 'PHP' started by upside, Aug 30, 2006.

  1. #1
    I wonder if the wise minds here could help me figure this one out. I need to call mysql fields based on user input but then make those fields editable by the user in a printable file. So, the user needs "diabetes", the script pulls description, symptoms, treatment from the db and presents them on a page the user can edit - ideally dumps them into a Word template. Could I modify a script that exports to Excel to do this? I don't think I've ever come across anything that would generate a Word file. Any ideas?
     
    upside, Aug 30, 2006 IP
  2. jocs

    jocs Peon

    Messages:
    103
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think it would be easyer to show your user a WYSWYG form, wich is very similar to Word, (like the one you use to write in this forum), and when it finishes editing, you generate (server side) a PDF document and prompt him the download (wich is easyer in PHP and its a free solution)

    If you want a proffesional solution, where user downloads a Ms Word document, you can try PHP RTF file Generator (Here, see live demo), this is the paid solution, it costs 58 USD.

    hope it helps.
     
    jocs, Aug 30, 2006 IP
  3. void

    void Peon

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I needed to go 1 step further than CSV for an account export earlier this month (need number formatting, column widths, bold text and aligned text) so used the Office XML format.

    I started with the usual CSV export code, loaded the file into Excel, formatted it to look how I wanted, saved it out as .xml, chopped the file about to remove some redundant nonsense then modified the php to export the xml format.

    Doing the same for Word shouldn't be too hard :)

    Edit: If you want to save it out as a .pdf, take a look at http://www.fpdf.org/
     
    void, Aug 30, 2006 IP