Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16773

Python script to print data inside text box in a word file

$
0
0

I am trying to print the values inside tables and text boxes as seen in the attached sample:

screenshot of the Word document

Using the code below, I am trying to get the values inside the text box, but I am not able to get it. My document has a text box on top of a background image. To check if the image is causing issues, I placed another text box below the table, but the code is still not able to read the values from that text box.

Any suggestions?

from docx import Documentdoc = Document('Test.docx')for i, table in enumerate(doc.tables, 1):    print(f"Table {i}:")    for row in table.rows:        for cell in row.cells:            print(cell.text, end='\t')        print()    print()

Viewing all articles
Browse latest Browse all 16773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>