This is my extended question for the question:
How to read contents of an Table in MS-Word file Using Python?
The solution provided by @YusuMishi is great, but it does not catch the headers in the header and footer.
Let me elaborate on that:
Using the code
import win32com.client as win32
import os
word = win32.Dispatch("Word.Application")
word.Visible = 0
p = os.path.abspath("Catch my tables.docx")
word.Documents.Open(p)
doc = word.ActiveDocument
print doc.Tables.Count
I will get 2
printed (Table 1
and Table 2
)
How do I go through the information in Table 0
and Table N