CenterForOpenScience / pydocx

An extendable docx file format parser and converter
Other
186 stars 55 forks source link

Implement 'effective_properties' for paragraphs #170

Open kylegibson opened 9 years ago

kylegibson commented 9 years ago

Paragraphs need to walk the style hierarchy chain and apply properties, just like Runs.

kylegibson commented 8 years ago

This means that the following numbering doesn't work:

document.xml

    <w:p>
      <w:pPr>
        <w:pStyle w:val="Level2"/>
      </w:pPr>
      <w:r>
        <w:t>Foo</w:t>
      </w:r>
    </w:p>

styles.xml

  <w:style w:type="paragraph" w:customStyle="1" w:styleId="Level2">
    <w:name w:val="Level 2"/>
    <w:basedOn w:val="Normal"/>
    <w:rsid w:val="006F70DD"/>
    <w:pPr>
      <w:numPr>
        <w:ilvl w:val="1"/>
        <w:numId w:val="2"/>
      </w:numPr>
      <w:spacing w:before="240"/>
      <w:ind w:right="-360"/>
      <w:outlineLvl w:val="1"/>
    </w:pPr>
  </w:style>

The above should appear numbered, but it doesn't because the numPr within the pPr of the Level2 style is not inherited.