Converting MS Word document to html in php

15,149

See the COM extension of PHP.

Example of the usage by the PHP site:

<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word = null;
?>
Share:
15,149
shasi kanth
Author by

shasi kanth

I am a Web Developer, Husband, Father and Singer. [I am #SOreadytohelp] When not doing work, I would spend time with meditation and music. My Developer Story

Updated on June 07, 2022

Comments

  • shasi kanth
    shasi kanth almost 2 years

    How can I convert a Microsoft Word document to html in php? I am using windows, and heard that the COM package does it.