wopihost
項目介紹
基于wopi協(xié)議開發(fā)的WopiHost, 支持word, excel,ppt(僅支持預(yù)覽)等文檔的預(yù)覽和編輯。
運行環(huán)境
需要安裝Office online 2016才可以使用,基于jdk 1.8,spring boot開發(fā)。
使用案例
word文檔預(yù)覽
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預(yù)覽
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預(yù)覽
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服務(wù)的ip。 使用時替換成自己的服務(wù)地址,將test.docx換成自己對應(yīng)文件路徑下的文件名。
常見問題
- word文檔僅支持.docx,不支持.doc格式。
- ppt僅支持預(yù)覽,不支持編輯。
- 如果wopihost的接口都沒有問題,但是不能預(yù)覽或者編輯文檔,可能wopi和Office Web Apps Server之間的網(wǎng)絡(luò)不能互通,也可能Office Web Apps Server有問題,建議重新安裝后重試。
- access_token沒有做校驗,需要的自己實現(xiàn)一下。
- 中文名字的文檔不能預(yù)覽、編輯,將中文名使用URLEncoder.encode進行兩次編碼。例如:哈哈哈.xlsx, 使用中文編碼后的名字作為參數(shù) .../wopi/files/%25e5%2593%2588%25e5%2593%2588%25e5%2593%2588.xlsx即可正常預(yù)覽。
轉(zhuǎn)載于:https://www.cnblogs.com/luchaoshuai/p/9790544.html
總結(jié)
 
                            
                        - 上一篇: 存储过程与函数的区别
- 下一篇: Android中利用productFla
