Open
Description
from docx.api import Document
import pandas as pd
from docx.shared import Pt
texts = []
sizes = []
document = Document('new.docx')
for p in document.paragraphs:
for run in p.runs:
if p.style.name.startswith("Normal") and run.font.size != Pt(11):
texts.append(run.text)
print(texts)
I am trying to validate a document, I want all the texts in the document where the font style is 'Normal' and font size is NOT 11. The above code seems to give output where font size is 11 as well. Is there a alternative to this? Thanks in advance!