如何在python中使用win32com将Word转换为图像?

发布于 2024-08-29 12:41:11 字数 499 浏览 2 评论 0原文

我在 google 上搜索了一个将 Word 转换为 Html 的示例。

import win32com 
from win32com.client import Dispatch, constants  
w = win32com.client.Dispatch('Word.Application') 
w = win32com.client.DispatchEx('Word.Application')

'''skip some code here'''

wc = win32com.client.constants 
w.ActiveDocument.SaveAs( FileName = filenameout, FileFormat = wc.wdFormatHTML )

我尝试在示例中寻找类似 wc.wdFormatPNG 作为 wc.wdFormatHTML 的内容,但失败了。我想知道该属性是否存在?或者有其他更好的解决方案吗?建议是赞赏。

I have googled an example for converting Word to Html.

import win32com 
from win32com.client import Dispatch, constants  
w = win32com.client.Dispatch('Word.Application') 
w = win32com.client.DispatchEx('Word.Application')

'''skip some code here'''

wc = win32com.client.constants 
w.ActiveDocument.SaveAs( FileName = filenameout, FileFormat = wc.wdFormatHTML )

I tried looking for something like wc.wdFormatPNG as wc.wdFormatHTML in the example but failed.And I wonder does the attribute exist?Or any other better solutions?Suggestions would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×纯※雪 2024-09-05 12:41:11

您可以尝试将 Word 文档打印为 PDF 或 TIFF 文件。我自己从未这样做过,但如果可以手动完成,很可能您可以将其自动化。

You can try to print the Word document to PDF or TIFF file. I never did it myself, but if it can be done manually, most probably you can automate it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文