A
A
anton5412021-10-22 14:39:53
Python
anton541, 2021-10-22 14:39:53

How to find and replace text in a Microsoft Word table?

Good evening! Tell. I have a table in Word (business cards). I need to find all "Name" values ​​in cells and replace them with "EdName" (for example). Through the normal method search, the paragraph is not obtained. Here is the code:

import docx
document = docx.Document("doccc.docx")
for table in document.tables:
   table.text = table.text.replace("Name", "Абра Кадабра")
document.save("doccc.docx")


Thank you in advance for your help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question