wopihost
項目介紹
基于wopi協議開發的WopiHost, 支持word, excel,ppt(僅支持預覽)等文檔的預覽和編輯。
運行環境
需要安裝Office online 2016才可以使用,基于jdk 1.8,spring boot開發。
使用案例
word文檔預覽
http://[owas.domain]/wv/wordviewerframe.aspx?WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.docx&access_token=123?
word文檔編輯
http://[owas.domain]/we/wordeditorframe.aspx?WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.docx&access_token=123?
excel預覽
http://[owas.domain]/x/_layouts/xlviewerinternal.aspx?ui=zh-CN&rs=zh-CN&WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.xlsx&access_token=123
excel編輯
http://[owas.domain]/x/_layouts/xlviewerinternal.aspx?edit=1&WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.xlsx&access_token=123
ppt預覽
http://[owas.domain]/p/PowerPointFrame.aspx?PowerPointView=ReadingView&WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.pptx&access_token=123
ppt編輯
http://[owas.domain]/p/PowerPointFrame.aspx?PowerPointView=EditView&WOPISrc=http://[WopiHost.domain]:8080/wopi/files/test.pptx&access_token=123
備注:[owas.domain]是Office online 2016的ip地址,[WopiHost.domain]是WopiHost服務的ip。 使用時替換成自己的服務地址,將test.docx換成自己對應文件路徑下的文件名。
常見問題
- word文檔僅支持.docx,不支持.doc格式。
- ppt僅支持預覽,不支持編輯。
- 如果wopihost的接口都沒有問題,但是不能預覽或者編輯文檔,可能wopi和Office Web Apps Server之間的網絡不能互通,也可能Office Web Apps Server有問題,建議重新安裝后重試。
- access_token沒有做校驗,需要的自己實現一下。
- 中文名字的文檔不能預覽、編輯,將中文名使用URLEncoder.encode進行兩次編碼。例如:哈哈哈.xlsx, 使用中文編碼后的名字作為參數 .../wopi/files/%25e5%2593%2588%25e5%2593%2588%25e5%2593%2588.xlsx即可正常預覽。
轉載于:https://www.cnblogs.com/luchaoshuai/p/9790544.html
總結
- 上一篇: 存储过程与函数的区别
- 下一篇: ELK套件FileBeat部署