在Python中读取/写入MS Word文件
问题描述:
是否可以在不使用COM对象的情况下用Python读取和写入Word(2003和2007)文件?
我知道我可以做到:
Is it possible to read and write Word (2003 and 2007) files in Python without using a COM object?
I know that I can:
f = open('c:\file.doc', "w")
f.write(text)
f.close()
但是Word会将其读取为HTML文件而不是本机.doc文件.
but Word will read it as an HTML file not a native .doc file.
答
我会研究 IronPython 可以访问Windows/Office API,因为它可以在.NET运行时上运行.
I'd look into IronPython which intrinsically has access to windows/office APIs because it runs on .NET runtime.