centos 下将doc转docx

2019-06-17  本文已影响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","存储路径"])
上一篇 下一篇

猜你喜欢

热点阅读