2013-01-17 32 views
1

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

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

您可以使用谷歌文档API在谷歌文档中打开文档 – Roopendra

回答

1

试试这个:

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

欲了解更多信息,请参阅this

0

您可以使用谷歌文档:

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