
October 1st, 2003, 01:04 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
about the article to convert .doc in .html
Well..al the code runs and it is all right :]
But ...i have read in the article:
Note the second argument passed to the SaveAs() method, the integer 8 - this is a numeric code which tells Word to save the document as HTML. Feel free to experiment with this number and create different file formats
///
Well i have tried with number 3 to convert a .doc with .txt.
In fact...all the code is here and it works perfectly:
PHP Code:
<?php
// htmlviewer.php
// convert a Word doc to an HTML file
//$DocumentPath = str_replace("\\", "\", $DocumentPath);
$DocumentPath="C:/Archivos de programa/Easyphp/www/subidas/curric.doc";
// create an instance of the Word application
$word = new COM("word.application") or die("Unable to instantiate application object");
// creating an instance of the Word Document object
$wordDocument = new COM("word.document") or die("Unable to instantiate document object");
$word->Visible = 0;
// open up an empty document
$wordDocument = $word->Documents->Open($DocumentPath);
// create the filename for the HTML version
$HTMLPath = substr_replace($DocumentPath, 'txt', -3, 3);
// save the document as HTML
$wordDocument->SaveAs($HTMLPath, 3);
// clean up
$wordDocument = null;
$word->Quit();
$word = null;
// redirect the browser to the newly-created document header("Location:". $HTMLPath);
header("Location:". $HTMLPath);
?>
The unique problem I have is that I must to accept the oppening of Microsoft Word (althought i have written $word->Visible = 0)
How can I avoid this?
How can I generate a txt from a .doc file without oppening Microsoft Word?
Regards from Spain.
Last edited by marylin77 : October 1st, 2003 at 01:17 PM.
|