Skip to content

Commit 0a1f432

Browse files
authored
Merge pull request #9 from njwhite/master
`pPr` Not Always Present
2 parents ce493b6 + 190431e commit 0a1f432

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/simplify_docx/utils/paragrapy_style.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def get_pStyle(p, doc):
66
"""
77
Get the referenced style element for a paragraph with a p.pPr.pStyle
88
"""
9-
if p.pPr is not None and \
9+
if getattr(p, "pPr", None) is not None and \
1010
p.pPr.pStyle is not None:
1111
return doc.styles.element.find("w:style[@w:styleId='%s']" % p.pPr.pStyle.val,
1212
doc.styles.element.nsmap)
@@ -17,7 +17,7 @@ def get_num_style(p, doc):
1717
"""
1818
The the paragraph's Numbering style
1919
"""
20-
if p.pPr is not None \
20+
if getattr(p, "pPr", None) is not None \
2121
and p.pPr.numPr is not None\
2222
and p.pPr.numPr.numId is not None:
2323
# the numbering style doc
@@ -47,7 +47,7 @@ def get_paragraph_ind(p, doc):
4747
* Direct Formatting
4848
"""
4949

50-
if p.pPr is not None and\
50+
if getattr(p, "pPr", None) is not None and\
5151
p.pPr.ind is not None:
5252
return p.pPr.ind
5353

0 commit comments

Comments
 (0)