View Full Version : Using PHP to create *.doc file
tanel96
February 10th, 2008, 05:02 PM
I'm not sure whether this is even possible, but i thought i would ask you guys.
I have a form that the visitor submits... and now my client needs to get the submitted form in a Word *.doc file to his email.
Can that be done ?
Templarian
February 10th, 2008, 05:14 PM
So you want to have a form that submits text that creates a doc file and attaches it to the email? (instead of just sending the text in the email normally?).
hl
February 10th, 2008, 06:13 PM
php word
tanel96
February 11th, 2008, 09:39 AM
yeah, the client wants the submitted data to be attached as a word document, because then he can make some adjustments to the price and send it back to the client.
I actually did google it, ... i just thought someone on this forum might have a better idea.
borrob
February 12th, 2008, 06:25 AM
The problem with word is that the COM is no longer available since ie7.
So the only way to use com objects is with a server version through exchange.
Though it is possible to create a html file and read it in word there are some setbacks because you cannot use the full capability off word.
My solution is a bit different, although not perfect it works for me.
I have a word doc template file ( just a normal document with the layout and all the things that are standard in the document. )
In this document i place a [some_name_to_replace01234567890]
I read the document in php as a normal file and search for the statement. Then i replace it with my value and add spaces so that the replaced text is the same length as the original. This is important because word uses a checksum in the document. If the document is longer or shorter after you alter it word will not read it anymore.
Maybe not the best wayto do this but it works for me....
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.