将有效的HTML输入转换为docx。
项目描述
html2docx
html2docx可以将有效的HTML输入转换为docx输出。该项目遵循MIT许可证发布。
安装
要安装,请使用pip
$ pip install html2docx
用法
from html2docx import html2docx
with open("my.html") as fp:
html = fp.read()
# html2docx() returns an io.BytesIO() object. The HTML must be valid.
buf = html2docx(html, title="My Document")
with open("my.docx", "wb") as fp:
fp.write(buf.getvalue())
测试
要运行测试套件,请使用tox
$ tox
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源代码分发
html2docx-1.6.0.tar.gz (47.0 kB 查看哈希值)
构建分发
html2docx-1.6.0-py3-none-any.whl (35.7 kB 查看哈希值)