Skip to main content

Create and update Microsoft Word .docx files.

Project description

python-docx-whtsky

https://travis-ci.com/whtsky/python-docx.svg?branch=master

python-docx-whtsky is a Python library for creating and updating Microsoft Word (.docx) files.

More information is available in the python-docx documentation

Release History

0.8.10.2 (2019-10-23)

Example

https://github.com/python-openxml/python-docx/issues/25#issuecomment-143231954

from docx import Document

document = Document()

# Add desired numbering styles to your template file.

# Extract abstractNumId from there. In this example, abstractNumId is 10

numId = document.get_new_list("10")

# Add a list

p = document.add_paragraph(style = 'ListParagraph', text = "a")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "b")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "c")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "d")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "e")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "f")
p.num_id = numId
p.level = 0

# Restart numbering at the outer level

numId = document.get_new_list("10")

# Add the same list once again. The numbering is restarted

p = document.add_paragraph(style = 'ListParagraph', text = "a")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "b")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "c")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "d")
p.num_id = numId
p.level = 0
p = document.add_paragraph(style = 'ListParagraph', text = "e")
p.num_id = numId
p.level = 1
p = document.add_paragraph(style = 'ListParagraph', text = "f")
p.num_id = numId
p.level = 0

document.save("num.docx")

0.8.10.1 (2019-10-16)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-docx-whtsky-0.8.10.2.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

python_docx_whtsky-0.8.10.2-py2.py3-none-any.whl (183.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-docx-whtsky-0.8.10.2.tar.gz.

File metadata

  • Download URL: python-docx-whtsky-0.8.10.2.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for python-docx-whtsky-0.8.10.2.tar.gz
Algorithm Hash digest
SHA256 603c7db2fb5a03c754428c20823b3eba1904b80da22b5f754131636b1bdcf240
MD5 6c453d99824e357c514d3b951689360a
BLAKE2b-256 3baa7f06a6b82f6e73ad3e6078d255e7693ff86e26ab4ef7b7f51cb06b7cf2a5

See more details on using hashes here.

File details

Details for the file python_docx_whtsky-0.8.10.2-py2.py3-none-any.whl.

File metadata

  • Download URL: python_docx_whtsky-0.8.10.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 183.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for python_docx_whtsky-0.8.10.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 473fcf8007222bace0462080ea3f8f71f3ed379c44e148b268ebbaff262e2aab
MD5 8d3b8521ecc0073d908c5649717a304b
BLAKE2b-256 9b8b11b2ba0f35a4718fa72c5e5e4593ea94387e0ced99e26fa689d8f0efd8ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page