HomePHP PHP: Creating Word Documents without .COM Objects
PHP: Creating Word Documents without .COM Objects
If you are looking for a solution to create MS Word documents without the use of .COM objects, then this tutorial will be helpful. In it, you will learn how to build an actual PHP application that can convert a .txt file into a .doc file online.
Before you implement this application in your own test server, bear in mind that this was tested to work on the following setup:
PHP Version: 5.2.5
Server: Apache
OS: Linux
MS Word version: MS Word 2002
You will need the following PHP functions/components to make this work:
require_once
$_FILES
file_get_contents
mt_rand
fopen
fwrite
This web application won't work if you try to implement it on a free web hosting platform, because hosting agencies will disable some of the functions listed above.
Also you will need to have a recaptcha account; this is the captcha solution that is used for this application. For the recaptcha to work, you will need:
a. Public Key
b. Private Key
c. Recaptcha PHP library files
You can get that on this page: http://www.google.com/recaptcha
It is highly recommended that you test this application first in the local server, such as XAMPP. So make sure you have a PHP-Apache test server installed on your system before uploading files to your web hosting company.