更新时间:2023-02-12 20:30:45
这就是我所做的:
这应该使您知道您需要做什么.之后,您可以使用Python中的XML库之一来解析文档,对其进行更改,然后将其添加回扩展名为".docx"的新ZIP存档中.只需从原始ZIP中复制所有其他条目,您就会获得一个新的有效Word文档.
This should give you an idea what you need to do. After that, you can use one of the XML libraries in Python to parse the document, change it and add it back to a new ZIP archive with the extension ".docx". Simply copy every other entry from the original ZIP and you have a new, valid Word document.
还有一个库可能会帮助您: openxmllib
There is also a library which might help: openxmllib