【python】通过LibreOffice把html文件转换成docx文件

时间:2018-08-24 17:17:37   收藏:0   阅读:1283

通过下面的一行命令,把test.html转换成test.docx

soffice --invisible --headless --convert-to docx:"Office Open XML Text" test.html

如果想要用python来执行这个命令的话:(请注意"Office Open XML Text"的双引号要去掉哦)

1 import subprocess
2 subprocess.call([‘soffice‘, ‘--invisible‘, ‘--headless‘, ‘--convert-to‘, ‘docx:Office Open XML Text‘, ‘test.html‘])

 

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!