简体   繁体   中英

Display ms document on a web browser using php or html

How can I display an ms word document to a web browser just like the way an image is displayed in html . I am using php and html , I tried it using iframe but my idea did not work .

<iframe name="houses" src="report.doc" width="580"></iframe>

try this :

<?php
        $word = new COM("word.application") or die ("Could not initialise MS Word object.");
        $word->Documents->Open(realpath("Sample.doc"));

        // Extract content.
        $content = (string) $word->ActiveDocument->Content;

        echo $content;

        $word->ActiveDocument->Close(false);

        $word->Quit();
        $word = null;
        unset($word);   
?>

for More Info Refer this

您可以使用Google文档:

<iframe src="http://docs.google.com/gview?url=http://www.example.com/report.doc"></iframe>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM