简体   繁体   English

需要在基于PHP Web的文档管理系统中查看MS Office文档

[英]Need to view ms office documents in a php web based document management system

I want to make a document viewer for MS office docs and pdf for my inhouse Document Management System made in php and mysql. 我想为使用php和mysql制作的内部文档管理系统制作MS Office文档和pdf的文档查看器。 I dont want the users to be able to edit these documents. 我不希望用户能够编辑这些文档。 we need to make it browser friendly as our system is web based. 由于我们的系统是基于Web的,因此我们需要使其对浏览器友好。

Thanks in advance 提前致谢

Chintan 金坛

You can also use iframe for that 您也可以使用iframe

<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>

but you should replace the http://infolab.stanford.edu/pub/papers/google.pdf with your own address. 但是您应该使用自己的地址替换http://infolab.stanford.edu/pub/papers/google.pdf As I mentioned, the document viewer works for PDF and PPT files. 如前所述,文档查看器适用于PDF和PPT文件。

You can use Google Docs and embed it in your page. 您可以使用Google Docs并将其嵌入到页面中。 You can do as below: 您可以执行以下操作:

http://docs.google.com/viewer?url=YourDocumentUrlHere

All viewer URLs should use the path http://docs.google.com/viewer . 所有查看器网址都应使用路径http://docs.google.com/viewer This path accepts two parameters: 此路径接受两个参数:

url : The URL of the document to view. This should be URL-encoded.
embedded : If set to true , the viewer will use an embedded mode interface.

EDIT: 编辑:

After your comment that you don't want to have your files uploaded to the Google server, you can still use COM libraries in Operating System through PHP to open the MS Office Documents. 发表您不想将文件上传到Google服务器的评论后,您仍然可以通过PHP在操作系统中使用COM libraries来打开MS Office文档。

$doc = new COM("word.application") or die ("Could not initialise MS Word object.");
$doc->Documents->Open(realpath("YourDocument.doc")); 
// Extract content.
$content = (string) $doc->ActiveDocument->Content;
echo $content;
$doc->ActiveDocument->Close(false);
$doc->Quit();
$doc = null;
unset($doc);

You can further go on formatting the text to be shown using CSS and HTML. 您可以进一步使用CSS和HTML格式化要显示的文本。 Hope this helps you out. 希望这可以帮助你。

We did it!!! 我们做到了!!!

While uploading the document we are storing the original document in the repository. 上载文档时,我们将原始文档存储在存储库中。 While viewing the document, we are using JODconverter and openoffice to view the documents in the iframe. 在查看文档时,我们使用JODconverter和openoffice在iframe中查看文档。

You can use GroupDocs Viewer for the purpose. 您可以为此使用GroupDocs Viewer All you would need to do is embed it into your page and the document (DOC, PDF, PPT, XLS etc.) will be available to be viewed. 您只需要将其嵌入到页面中,即可查看文档(DOC,PDF,PPT,XLS等)。 It is a user and browser-friendly tool. 它是用户和浏览器友好的工具。 To embed docs, it will provide an embed code and you can make use of it. 要嵌入文档,它将提供一个嵌入代码,您可以使用它。

I am recommending it because I have found this viewer to be more secure compared to Google docs and the document rendering is quite fast and close to the original. 我之所以推荐它,是因为我发现该查看器比Google文档更安全,并且文档渲染速度非常快,并且接近原始文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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