Fri Sep 13, 2024 10:40 am
你好,
感谢你的反馈。我们的产品转换word 到Html 是依据微软标准的,你的原文档直接在微软word中转换到html,打开时第一张图片也是很模糊的。但是通过我们产品转之前,你可以先针对图片高宽进行修改设置,然后再转html,例如下面示例代码设置。
- Code: Select all
document = Document()
document.LoadFromFile("../ceshi3.docx")
# Get the first secion
section = document.Sections[0]
# Get the first paragraph
paragraph = section.Paragraphs[0]
# Reset the image size of the first paragraph
for i in range(paragraph.ChildObjects.Count):
docObj = paragraph.ChildObjects.get_Item(i)
if isinstance(docObj, DocPicture):
picture = DocPicture(docObj)
picture.Width = 500
picture.Height = 500
document.HtmlExportOptions.ImageEmbedded = False
document.HtmlExportOptions.ImagesPath = "Images/"
document.SaveToFile("result_html.html", FileFormat.Html)
document.Close()
Sincerely,
Amin
E-iceblue support team