10-26-2007, 03:29 PM
|
#5 (permalink)
|
|
The Contributor
Join Date: Oct 2007
Posts: 44
Thanks: 0
|
ok.thanks salathe.i have 1 problem.if i have a doc type file and i want to open it i should convert it first to txt.my problem is i dont know a script that convert doc to txt.i saw on internet this code
[php]
$word = new COM("word.application") or die("Unable to instantiate Word");
$word->Documents->Open($filename);
$new_filename = substr($filename,0,-4) . ".txt";
// the '2' parameter specifies saving in txt format
$word->Documents[1]->SaveAs($new_filename,2);
$word->Documents[1]->Close(false);
$word->Quit();
$word->Release();
$word = NULL;
unset($word);
$fh = fopen($new_filename, 'r');
$contents = fread($fh, filesize($new_filename));
fclose($fh);
unlink($new_filename);
[php]
i tried to run this but theres an error on it class COM is not defined what does that mean?
|
|
|
|