Inserting form details into MS Word Document

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

mikeh
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Apr 08, 2003 1:32 pm
Location: UK
Contact:

Inserting form details into MS Word Document

Postby mikeh » Tue Apr 08, 2003 1:36 pm

I have been assigned a task...

1. Create a form (simple).
2. Use the inputted details in the form to create a Microsoft Word Document automatically (not so simple)
3. Depending on a selection made by the user, either email the document as an attachment (simple) or print the document for faxing (simple).

So you can see where I am stuck.

Can anyone point me in the right direction? I have asked the same question in a couple of other forums that I visit, but no-one seems to be able to help!

andrewdavey
New php-forum User
New php-forum User
Posts: 16
Joined: Wed Feb 12, 2003 5:27 am
Location: Cornwall, England

Replace token place holders

Postby andrewdavey » Wed Apr 09, 2003 2:47 am

How about creating a word document that has place holders where you want actual data to go? You can them open this file in PHP and replace the place holders with values from the form.

mikeh
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Apr 08, 2003 1:32 pm
Location: UK
Contact:

Postby mikeh » Wed Apr 09, 2003 2:57 am

makes sense...

do you mean use the word document like a template? and replacing placeholders such as [*NAME*] etc... as an example?

Would this let me then save the word document ready to email or print?

User avatar
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Postby Skeletor » Wed Apr 09, 2003 6:03 am

Exactly. You could just have php use the template and fill it in with your new data, then save it as another name.

There may be fancy functions to help you with this. I know there is when writting to a PDF or FDF file.

I know you can do this with Excel, so chances are you can do it with word: You could have php create a word object in your browser window if you choose to print it, and just display the newly created word object to your browser window for printing, or save it and email the saved file.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests