I want to access to a paragraph or run that has a unique font or font-size using python-docx. How i can get texts of runs or paragraphs that has specified font or font-size?
Asked
Active
Viewed 3,302 times
1 Answers
5
For any one that want to know:
for paragraph in doc.paragraphs:
for run in paragraph.runs:
if run.font.size == Pt(16):
print(paragraph.text)

keramat
- 4,328
- 6
- 25
- 38
-
-
Take a look at [this answer](https://stackoverflow.com/questions/76650844/find-all-the-texts-which-is-normal-style-and-font-size-is-not-11-in-a-docx-fil/76651650#76651650) – andexte Jul 10 '23 at 07:46