12 lines
397 B
Python
12 lines
397 B
Python
|
|
from spire.doc import FileFormat,XHTMLValidationType,Document
|
||
|
|
# from spire.doc.common import *
|
||
|
|
|
||
|
|
# 创建Document类的对象
|
||
|
|
document = Document()
|
||
|
|
|
||
|
|
# 加载一个HTML文件
|
||
|
|
document.LoadFromFile("output/generated_report.html", FileFormat.Html, XHTMLValidationType.none)
|
||
|
|
|
||
|
|
# 将HTML文件保存为.docx格式
|
||
|
|
document.SaveToFile("Html文件转为Word2.docx", FileFormat.Docx2016)
|
||
|
|
document.Close()
|