Skip to content

Commit ae5efe7

Browse files
committed
Do not add formattings if there's already one with the same tag
1 parent fbbd2f4 commit ae5efe7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

docxcompose/composer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ def retain_formatting_from_default_styles(self, doc):
365365
# For every paragraph property without a style, we add the
366366
# formattings from the default style.
367367
for el in xpath(doc.element, ".//w:pPr[not(w:pStyle)]"):
368+
existing_tags = set([child.tag for child in el.getchildren()])
368369
for paragraph_property in paragraph_properties:
370+
if paragraph_property.tag in existing_tags:
371+
continue
369372
el.append(deepcopy(paragraph_property))
370373

371374
def add_styles(self, doc, element):

0 commit comments

Comments
 (0)