美文网首页
centos 下将doc转docx

centos 下将doc转docx

作者: 刹那的既视感 | 来源:发表于2019-06-17 10:48 被阅读0次

由于antiword只能讲doc的文本读取出来,不能对里面的图片的资源读取,改为使用libreoffice

安装模块

yum install libreoffice
yum install libreoffice-headless
soffice --headless --invisible --convert-to docx /目标文件路径 --outdir /存储路径

不加outdir的话则在当前路径下保存

使用python

import subprocess
output = subprocess.call(["soffice","--headless","--invisible","--convert-to","docx","目标文件路径","--outdir","存储路径"])

相关文章

网友评论

      本文标题:centos 下将doc转docx

      本文链接:https://www.haomeiwen.com/subject/aexvoqtx.html