首先给大家推荐一个免费的转换网站: WWW.1314tool.com
linux下 可以用openoffice 或者 libreoffice 进行转行。此处讲一下 libreoffice
libreoffice
1-1 通过yum 安装
[root[@desktop](https://my.oschina.net/u/3769859) ~]# yum install libreoffice-headless
[root[@desktop](https://my.oschina.net/u/3769859) ~]# yum install libreoffice-writer
注意:
若运行转码命令抛出如下异常:
/usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option or check permissions of your X-Server
(See "man X" resp. "man xhost" for details)
需要执行如下如下命令后重新运行即可:
[root&desktop ~]# export DISPLAY=:0.0
1-2 libroffice 把word 转成html
格式为:
libreoffice6.0 --invisible --convert-to html --outdir (目标文件夹) (源doc文件)
比如:
libreoffice --invisible --convert-to html --outdir /data/wwwroot/newbjq/Upload/word/2020-04-22/202004221813348002954040.html /data/wwwroot/newbjq/Upload/word/2020-04-22/5e9fca90a09b6.docx