onlyoffice支持wps、dps和et格式的预览和编辑,支持office2003版本的编辑, 增加中文字体,字号

一、支持wps、dps和et格式的预览和编辑,支持office2003版本的编辑

onlyoffice的版本为7.2.2

1、修改documentserver,进入docker容器

docker exec -it onlyoffice-server bash

进入 /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/ 目录,在api.js中以下两处添加添加wps、et和dps

cd /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/
vim api.js
var appMap = {
      'text': 'docx',
      'text-pdf': 'pdf',
      'spreadsheet': 'xlsx',
      'presentation': 'pptx',
      'word': 'docx',
      'cell': 'xlsx',
      'slide': 'pptx',
      'wps': 'docx',
      'et': 'xlsx',
      'dps': 'pptx'
  }, app;
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|et)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|dps)|(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|wps))$/
                                    .exec(_config.document.fileType);

删掉api.js.gz文件

rm -rf api.js.gz

2、修改onlyoffice源码

修改配置文件代码,config.py

import os

FILE_SIZE_MAX = 5242880
STORAGE_PATH = 'app_data'
DOC_FOLDER = "doc"

DOC_SERV_VIEWED = [".pdf", ".djvu", ".xps"]
DOC_SERV_EDITED = [".docx", ".xlsx", ".csv", ".pptx", ".txt", ".wps", ".xls", ".doc", ".dps", ".et"]
DOC_SERV_CONVERT = [
    ".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt",
    ".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm",
    ".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt",
    ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot",
    ".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub"
]

DOC_SERV_TIMEOUT = 120000

DOC_SERV_CONVERTER_URL = 'http://0.0.0.0:9880/ConvertService.ashx'
DOC_SERV_API_URL = 'http://0.0.0.0:9880/web-apps/apps/api/documents/api.js'
DOC_SERV_PRELOADER_URL = 'http://0.0.0.0:9880/web-apps/apps/api/documents/cache-scripts.html'

EXAMPLE_DOMAIN = 'http://0.0.0.0:8000/'

DOC_SERV_JWT_SECRET = 'rtf_jwt_secret'


EXT_SPREADSHEET = [
    ".xls", ".xlsx", ".xlsm",
    ".xlt", ".xltx", ".xltm",
    ".ods", ".fods", ".ots", ".csv", ".et"
]

EXT_PRESENTATION = [
    ".pps", ".ppsx", ".ppsm",
    ".ppt", ".pptx", ".pptm",
    ".pot", ".potx", ".potm",
    ".odp", ".fodp", ".otp", ".dps"
]

EXT_DOCUMENT = [
    ".doc", ".docx", ".docm",
    ".dot", ".dotx", ".dotm",
    ".odt", ".fodt", ".ott", ".rtf", ".txt",
    ".html", ".htm", ".mht",
    ".pdf", ".djvu", ".fb2", ".epub", ".xps", "wps"
]


if os.environ.get("EXAMPLE_DOMAIN"):
    EXAMPLE_DOMAIN = os.environ.get("EXAMPLE_DOMAIN")
    
if os.environ.get("DOC_SERV"):
    base = os.environ.get("DOC_SERV").rstrip('/')
    DOC_SERV_CONVERTER_URL = base + '/ConvertService.ashx'
    DOC_SERV_API_URL = base + '/web-apps/apps/api/documents/api.js'
    DOC_SERV_PRELOADER_URL = base + '/web-apps/apps/api/documents/cache-scripts.html'

二、中文字体设置

进入容器

docker exec -it onlyoffice-server bash

删除自带字体

cd /var/www/onlyoffice/documentserver/core-fonts/     
rm -rf *

退出docker容器

exit

将字体复制到/var/www/onlyoffice/documentserver/core-fonts/文件夹下

docker cp /home/Fonts onlyoffice-server:/var/www/onlyoffice/documentserver/core-fonts/

进入到docker容器 :

docker exec -it onlyoffice-server bash

在docker容器里执行命令:

 /usr/bin/documentserver-generate-allfonts.sh

退出docker容器

 exit

重启docker镜像:

docker restart onlyoffice-server

三、中文字号添加

进入容器

docker exec -it onlyoffice-server bash

使用vim编辑app.js文件

vim /var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/app.js 

找到{value:8,displayValue:“8”}这个位置, 在前面添加以下字号

{value:42,displayValue:"初号"},
{value:36,displayValue:"小初"},
{value:26,displayValue:"一号"},
{value:24,displayValue:"小一"},
{value:22,displayValue:"二号"},
{value:18,displayValue:"小二"},
{value:16,displayValue:"三号"},
{value:15,displayValue:"小三"},
{value:14,displayValue:"四号"},
{value:12,displayValue:"小四"},
{value:10.5,displayValue:"五号"},
{value:9,displayValue:"小五"},
{value:7.5,displayValue:"六号"},
{value:6.5,displayValue:"小六"},
{value:5.5,displayValue:"七号"},
{value:5,displayValue:"八号"},

删除app.js.gz文件

rm -rf app.js.gz

退出docker容器

 exit

重启docker镜像:

docker restart onlyoffice-server

注意:测试时清楚本地缓存

你可能感兴趣的:(wps,onlyoffice,在线文档)