如何在python中使用win32com将Word转换为图像?
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将 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.