Access word document

How to Get Results in the Word file? Or how to print the results in the Word file?
i want each result to be at new word document
using php

Hey there,

Php file writing is very similar to languages like C, check out the tutorial below:

You need to specify your file as file.doc instead of file.txt.
The .doc file extension tells windows to open it with word. :wink:

I found this code for you. Check this.

function parseWord($userDoc)
$fileHandle = fopen($userDoc, “r”);
$line = @fread($fileHandle, filesize($userDoc));
$lines = explode(chr(0x0D),$line);
$outtext = “”;
foreach($lines as $thisline)
$pos = strpos($thisline, chr(0x00));
if (($pos !== FALSE)||(strlen($thisline)==0))
} else {
$outtext .= $thisline." “;
$outtext = preg_replace(”/[^a-zA-Z0-9\s\,\.\-
\r\ @\/\_\(\)]/“,”",$outtext);
return $outtext;

$userDoc = “cv.doc”;

$text = parseWord($userDoc);
echo $text;


yes,but I wanna have each result at new word document
I wanna code create new document automatic