In Python is there a easy way to read a word document line by line. I would like to preserve the formatting while reading the line and copy to other doc after modifying some text.
I can see there is only paragraph reading but no line reading available in docx library.
Try this:-
import docx
doc = docx.Document('your file')
for i in doc.paragraphs:
print(i.text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With