所有人
所以这就是我发现的。我将分享我写的代码来修正它。在
在这样做的时候,我学习了如何清除表的内容(特定的行和列)、如何添加行、获取word表中的列和行数等等。我还发现,由于没有太多关于python/win32的API可用的文档(除了MSDN库),我认为习惯这些API的一个方法是理解VB代码(主要是它现在的@MSDNhttp://msdn.microsoft.com/en-us/library/bb244515.aspx),并尝试为python-win32编写相应的类似代码。这是我的理解。在
…//########################
#
# Purpose : To update the Table contents present in file
# @ name : name of the document to process.
# @ tableCount : Specific Table number to edit.
#
#######################
def updateTable(name,tableCount):
#tell word to open the document
word.Documents.Open (IP_Directory_Dest + "\\" + name)
#open it internally
doc = word.Documents(1)
# answer to Question # 2 (how to update a specific cell in a TABLE)
# clearing Table # 1, Row # 1, cell # 1 content
doc.Tables (1). R