本人测试的onlyoffice为7.1.1社区版。修改onlyoffice文件api.js。
1、在api.js中找到下段代码
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf))$/
2、分别加入对应word文件wps,excel文件et,PowerPoint文件dps
var type = /^(?:(et|xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(dps|pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(wps|doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf))$/
3、通过7Z压缩软件把api.js压缩为api.js.gz
4、修改文件nextcloud文件appconfig.php
docker文件路径:/var/www/html/custom_apps/onlyoffice/lib/appconfig.php
修改下面这一条(这条是为了可以在线编辑doc文件,但另外需要重编译onlyoffice,想见下文)
"doc" => [ "mime" => "application/msword", "type" => "word","edit" => true, "conv" => true, "saveas" => ["docx", "odt", "pdf", "rtf", "txt"] ],
新增下面三条
"wps" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "word", "edit" => true, "def" => true, "review" => true, "comment" => true, "saveas" => ["odt", "pdf", "rtf", "txt", "docxf"] ],
"dps" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "slide", "edit" => true, "def" => true, "comment" => true, "saveas" => ["pdf", "odp"] ],
"et" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "cell", "edit" => true, "def" => true, "comment" => true, "modifyFilter" => true, "saveas" => ["csv", "ods", "pdf"] ],
6、docker文件路径:/var/www/html/resources/config/mimetypemapping.dist.json
新增下面三条
"et": ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
"dps": ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
"wps": ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
这样就可以在nextcloud中通过onlyoffice在线浏览wps、et、dps文件,但编辑后不能保存,这是因为onlyoffie默认不支持。如有需要可私信定制二次开发,也可以下载本人编译好的基础版docker离线镜像。