Read word and output as HTML
Moderator: General Moderators
Read word and output as HTML
Im looking to read word files and diplay the info as HTML.
Not really sure where to begin.
I've hard COM mentioned a lot, but haven't got a clue about that at all.
Any pointers?
Thanks
Mark
Not really sure where to begin.
I've hard COM mentioned a lot, but haven't got a clue about that at all.
Any pointers?
Thanks
Mark
okay, i got a script.
But, do i need to change anything in my PHP to allow the use of COM?
Can't see anything in the manual.
The script above when run, just sits there in the browser and nerver ends and never outputs anything?
Mark
Code: Select all
<?
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
// if you want see thw World interface the value must be '1' else '0'
$word->Visible = 0;
//doc file location
$word->Documents->Open("c:\\first.doc");
//html file location '8' mean HTML format
$word->Documents[1]->SaveAs("c:\\test_doc.html",8);
//closing word
$word->Quit();
//free the object from the memory
$word->Release();
$word = null;
?>Can't see anything in the manual.
The script above when run, just sits there in the browser and nerver ends and never outputs anything?
Mark
you should try it as console-application first. Maybe there's a popup and the task is never finished. I remember when I did this in a c++-class there were some unexpected message boxes, e.g. a confirmation request because of losing some formatting informations when saving as html. And there was a property to be set to avoid the UI-elements.
just run the script from a dos box, e.g.
Code: Select all
d:\path\to\php.exe -f e:\path\to\script.php-- caution: wild guessing follows --
remember the nag screen when you started ms office/word for the first time? That one where you should enter your name, your initials and whatever. The webserver probably handles the request with another account than the one that has been configured. So maybe it's trying to show that screen again for the new user, after all the usual word.exe is started for the word.application object. By default a win32-service is not allowed to display UI elements on the desktop, i.e. if it uses the "local system" account.
It would fit the behaviour you've descripted. But I've banned ms office completely from my box (no I'm not a no-m$ stickler, simply no need for it
) so I can't test it.
From the services-applet you can open the property sheet of the webserver. If it's configured to use "local system" you might try the checkbox right below that setting, allowing the service to access the default desktop.
But as mentioned: it's a long shot.
remember the nag screen when you started ms office/word for the first time? That one where you should enter your name, your initials and whatever. The webserver probably handles the request with another account than the one that has been configured. So maybe it's trying to show that screen again for the new user, after all the usual word.exe is started for the word.application object. By default a win32-service is not allowed to display UI elements on the desktop, i.e. if it uses the "local system" account.
It would fit the behaviour you've descripted. But I've banned ms office completely from my box (no I'm not a no-m$ stickler, simply no need for it
From the services-applet you can open the property sheet of the webserver. If it's configured to use "local system" you might try the checkbox right below that setting, allowing the service to access the default desktop.
But as mentioned: it's a long shot.
found this on the PHP manual
I am on win98. How can i allow PHP to access the UI?
Mark
Apparently i need to start -> run and type dcomcnfg but that is only for NT/2K/XP.It should be noted that to run anything that needs to interact with the UI (the word example), one needs to ensure that the process that the Web server is running under can access the UI. For Apache, this is an option in the Services control panel.
I am on win98. How can i allow PHP to access the UI?
Mark