Help with PHP and MSWORD docs
Posted: Sat May 13, 2006 11:27 pm
I wrote a script that replaces "template vars" in a word document with values a user submits from a form. When the submit button is hit, the template MSWORD document is opened up and read into variable. The "template vars" are then replaced with the form values and the document is saved and the user may then download the document. But when you attempt to open up the document, you get an error that says :
"Word experienced an error trying to open this file. Try these suggestions. *Check the file permissions for the document or drive *make sure there is sufficient free memory and diskspace * open the file with the text recovery converter"
When I comment out the loop that replaces the "template vars" so no changes to the template file are made, and php saves the file, you can open it and view it regularly, so i know the problem is something with the str_replace, preg_replace, ereg_replace functions i've tried. All get the same error when they're used and you try to open the documents.
What do i need to do so that the word document is viewable?
Someone please help! If you want to view the files, you can download them in zip format here:
http://www.lancesnyder.com/problem.zip
If someone could please help me i would REALLY appreciate it!!
"Word experienced an error trying to open this file. Try these suggestions. *Check the file permissions for the document or drive *make sure there is sufficient free memory and diskspace * open the file with the text recovery converter"
When I comment out the loop that replaces the "template vars" so no changes to the template file are made, and php saves the file, you can open it and view it regularly, so i know the problem is something with the str_replace, preg_replace, ereg_replace functions i've tried. All get the same error when they're used and you try to open the documents.
What do i need to do so that the word document is viewable?
Someone please help! If you want to view the files, you can download them in zip format here:
http://www.lancesnyder.com/problem.zip
If someone could please help me i would REALLY appreciate it!!