Skip to content

Odd margin being added to bullets #224

@jhubert

Description

@jhubert

When certain docx files that have adjusted margins get imported, the resulting HTML places the margin in the wrong place. This results in oddly formatted HTML.

For example, here are two lists in word:

image

The first list has been indented, the second one has the standard doc indentation.

Here is the result in HTML:

image

The resulting HTML has a span inside the li with a margin-left set on it:

<li><span style="margin-left:3.00em">This is a list item</span></li>

It seems that the whole ul should have the margin, if anything at all.

Here is the sample file:
list-item-margin.docx

And here is the cleaned up docx source from the document.xml file:

  <w:p w14:paraId="25B98899" w14:textId="77777777" w:rsidR="00442583" w:rsidRDefault="00442583" w:rsidP="00442583">
    <w:r>
      <w:t>Headline:</w:t>
    </w:r>
  </w:p>
  <w:p w14:paraId="59BA247B" w14:textId="77777777" w:rsidR="00442583" w:rsidRDefault="00442583" w:rsidP="00442583">
    <w:pPr>
      <w:pStyle w:val="ListParagraph"/>
      <w:numPr>
        <w:ilvl w:val="0"/>
        <w:numId w:val="2"/>
      </w:numPr>
      <w:ind w:left="720"/>
    </w:pPr>
    <w:r>
      <w:t>This is a list item</w:t>
    </w:r>
  </w:p>
  <w:p w14:paraId="551666C9" w14:textId="77777777" w:rsidR="00442583" w:rsidRDefault="00442583" w:rsidP="00442583">
    <w:pPr>
      <w:pStyle w:val="ListParagraph"/>
      <w:numPr>
        <w:ilvl w:val="0"/>
        <w:numId w:val="2"/>
      </w:numPr>
      <w:ind w:left="720"/>
    </w:pPr>
    <w:r>
      <w:t>This is a list item</w:t>
    </w:r>
  </w:p>
  <w:p w14:paraId="1A7915D0" w14:textId="08BE8BEB" w:rsidR="005D0069" w:rsidRDefault="005D0069" w:rsidP="00892FBD"/>
  <w:p w14:paraId="29C5692C" w14:textId="323CB438" w:rsidR="00FB2CED" w:rsidRDefault="00FB2CED" w:rsidP="00892FBD">
    <w:r>
      <w:t>Headline:</w:t>
    </w:r>
  </w:p>
  <w:p w14:paraId="156080DF" w14:textId="24763A50" w:rsidR="00FB2CED" w:rsidRDefault="00FB2CED" w:rsidP="00FB2CED">
    <w:pPr>
      <w:pStyle w:val="ListParagraph"/>
      <w:numPr>
        <w:ilvl w:val="0"/>
        <w:numId w:val="3"/>
      </w:numPr>
    </w:pPr>
    <w:r>
      <w:t>This is a list item</w:t>
    </w:r>
  </w:p>
  <w:p w14:paraId="5DDA8D93" w14:textId="4FE9F6C2" w:rsidR="00FB2CED" w:rsidRDefault="00FB2CED" w:rsidP="00FB2CED">
    <w:pPr>
      <w:pStyle w:val="ListParagraph"/>
      <w:numPr>
        <w:ilvl w:val="0"/>
        <w:numId w:val="3"/>
      </w:numPr>
    </w:pPr>
    <w:r>
      <w:t>This is a list item</w:t>
    </w:r>
  </w:p>

The difference seems to be the existence of the <w:ind w:left="720"/> value, which I'm assuming is telling pydocx to add an indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions