python-docx-whtsky is a Python library for creating and updating Microsoft Word (.docx) files.
More information is available in the python-docx documentation
- TableCell's
add_tablemethod acceptsfirstCol, firstRow, lastCol, lastRow, hBand, vBand)now.
- Add ability to restart list numbering. ( python-openxml#210 )
Example
fromdocximportDocumentdocument=Document() # Add desired numbering styles to your template file.# Extract abstractNumId from there. In this example, abstractNumId is 10numId=document.get_new_list("10") # Add a listp=document.add_paragraph(style='ListParagraph', text="a") p.num_id=numIdp.level=0p=document.add_paragraph(style='ListParagraph', text="b") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="c") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="d") p.num_id=numIdp.level=0p=document.add_paragraph(style='ListParagraph', text="e") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="f") p.num_id=numIdp.level=0# Restart numbering at the outer levelnumId=document.get_new_list("10") # Add the same list once again. The numbering is restartedp=document.add_paragraph(style='ListParagraph', text="a") p.num_id=numIdp.level=0p=document.add_paragraph(style='ListParagraph', text="b") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="c") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="d") p.num_id=numIdp.level=0p=document.add_paragraph(style='ListParagraph', text="e") p.num_id=numIdp.level=1p=document.add_paragraph(style='ListParagraph', text="f") p.num_id=numIdp.level=0document.save("num.docx")- allow table looking (header row/col, footer row/col, bands) modification. python-openxml#579
- Added font property to paragraph. python-openxml#417