python-openxml/python-docx

Enumeration / Lists: Missing indention

buhtz opened this issue · 2 comments

buhtz commented

image

The first two enumerations in this screenshots are created using code like this, where I use the styles List Bullet and List Number.

document.add_paragraph(
    'first item in unordered list', style='List Bullet'
)
document.add_paragraph(
    'first item in ordered list', style='List Number'
)

But in the result (screenshot) this enumerations do not look the same way as the original MS Word enumeration (the 3rd in the screenshot) does. The indention is missing.

I am assuming that I miss a basics concept here?

buhtz commented

To my understanding there is a style List Paragraph beside List Number and List Bullet. But when using List Paragraph the indention is there but the bullet points or numbers are missing.

Somehow I need to add them both?

ghollf commented

Word uses a different style that also includes an indention definition ...

<w:style w:type="paragraph" w:styleId="Listenabsatz">
	<w:name w:val="List Paragraph"/>
	<w:basedOn w:val="Standard"/>
	<w:uiPriority w:val="34"/>
	<w:qFormat/>
	<w:rsid w:val="00201BB5"/>
	<w:pPr>
		<w:ind w:left="720"/>
		<w:contextualSpacing/>
	</w:pPr>
</w:style>