使用php或html在web浏览器上显示ms文档

使用php或html在web浏览器上显示ms文档,php,html,Php,Html,如何将ms word文档显示到web浏览器,就像在html中显示图像一样。我正在使用php和html,我尝试使用iframe,但我的想法没有奏效 <iframe name="houses" src="report.doc" width="580"></iframe> 试试这个: <?php $word = new COM("word.application") or die ("Could not initialise MS Word objec

如何将ms word文档显示到web浏览器,就像在html中显示图像一样。我正在使用php和html,我尝试使用iframe,但我的想法没有奏效

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

试试这个:

<?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);   
?>

有关更多信息,请参阅以下内容:

<?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);   
?>


有关更多信息,请参考

您可以使用谷歌文档:

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

您可以使用谷歌文档:

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


您可以使用google doc api在google doc中打开文档您可以使用google doc api在google doc中打开文档