[英]Need to view ms office documents in a php web based document management system
我想為使用php和mysql制作的內部文檔管理系統制作MS Office文檔和pdf的文檔查看器。 我不希望用戶能夠編輯這些文檔。 由於我們的系統是基於Web的,因此我們需要使其對瀏覽器友好。
提前致謝
金壇
您也可以使用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>
但是您應該使用自己的地址替換http://infolab.stanford.edu/pub/papers/google.pdf
。 如前所述,文檔查看器適用於PDF和PPT文件。
您可以使用Google Docs
並將其嵌入到頁面中。 您可以執行以下操作:
http://docs.google.com/viewer?url=YourDocumentUrlHere
所有查看器網址都應使用路徑http://docs.google.com/viewer
。 此路徑接受兩個參數:
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.
編輯:
發表您不想將文件上傳到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);
您可以進一步使用CSS和HTML格式化要顯示的文本。 希望這可以幫助你。
我們做到了!!!
上載文檔時,我們將原始文檔存儲在存儲庫中。 在查看文檔時,我們使用JODconverter和openoffice在iframe中查看文檔。
您可以為此使用GroupDocs Viewer 。 您只需要將其嵌入到頁面中,即可查看文檔(DOC,PDF,PPT,XLS等)。 它是用戶和瀏覽器友好的工具。 要嵌入文檔,它將提供一個嵌入代碼,您可以使用它。
我之所以推薦它,是因為我發現該查看器比Google文檔更安全,並且文檔渲染速度非常快,並且接近原始文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.