View Single Post
Old 02-06-2009, 02:07 AM   #9 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
That works SketchMedia, with a little bit of re-working. I used the following code and it output a txt document for me, with a folder as well with 2 other files in:

php Code:
try
{
    $szOpenDocument = 'C:/wamp/www/word/word-open.doc';
    $szSaveDocument = 'C:/wamp/www/word/word-save.txt';

    $pWordCOM = new COM("word.application");
    $pWordCOM->Documents->Open($szOpenDocument);
    $pWordCOM->ActiveDocument->SaveAs($szSaveDocument, 8);
    $pWordCOM->ActiveDocument->Close(false);
    $pWordCOM->Quit();
    unset($pWordCOM);
}
catch(Exception $e)
{
    die($e->getMessage());
}
Thanks!

Just a question though.
Where do you find info about the Documents and Open thingy?
As used here:
PHP Code:
$pWordCOM->Documents->Open($szOpenDocument); 
Also, these things?
PHP Code:
$pWordCOM->ActiveDocument->SaveAs($szSaveDocument8); 
As said before, I found the info about the COM class, but it didn't have any of those functions.. ActiveDocument nor Documents..

Anyways, thanks! However, I didn't really want to save it as a txt.. I wanted to get the HTML code so I can post it on the website, without having to write the HTML code for bold and tables wherever they are used..
__________________
Tanax is offline  
Reply With Quote