I am unable to parse through the corrections in the words document through the docx library

Viewed 26

I have been trying to parse through the text document, which is a compared document and i want to extract the text in the document which was corrected, which is distinguished by the strike on the error.. To be able to view the corrections, I'd have to set Review->All markup and set showmarkup.

But when I parse through the text using the library, I don't seem to find the striked text in the text returned.

following is the code:

import docx
filename='123.docx'
def getText(filename):
    doc = docx.Document(filename)
    fullText = []
    for para in doc.paragraphs:
        fullText.append(para.text)
    return '\n'.join(fullText)
getText(filename)

I was planning on using the stike attribute in the library to extract the corrected words, but it dosent seem to parse through the compared doc.

The correction looks like this:

slow it is slow

The text returned by the parse only has "it is slow"

0 Answers
Related