1. 程式人生 > >【python】通過LibreOffice把html文件轉換成docx文件

【python】通過LibreOffice把html文件轉換成docx文件

去掉 less 通過 文件 bre eof html ice 要去

通過下面的一行命令,把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])

【python】通過LibreOffice把html文件轉換成docx文件