Skip to content

numbering

numbering

NumberingPart and closely related objects.

NumberingPart

NumberingPart(
    partname: PackURI,
    content_type: str,
    element: BaseOxmlElement,
    package: Package,
)

Bases: XmlPart

Proxy for the numbering.xml part containing numbering definitions for a document or glossary.

Source code in src/docx/opc/part.py
def __init__(
    self, partname: PackURI, content_type: str, element: BaseOxmlElement, package: Package
):
    super(XmlPart, self).__init__(partname, content_type, package=package)
    self._element = element

new classmethod

new() -> NumberingPart

Newly created numbering part, containing only the root <w:numbering> element.

Source code in src/docx/parts/numbering.py
@classmethod
def new(cls) -> "NumberingPart":
    """Newly created numbering part, containing only the root ``<w:numbering>`` element."""
    raise NotImplementedError

numbering_definitions

numbering_definitions()

The _NumberingDefinitions instance containing the numbering definitions ( element proxies) for this numbering part.

Source code in src/docx/parts/numbering.py
@lazyproperty
def numbering_definitions(self):
    """The |_NumberingDefinitions| instance containing the numbering definitions
    (<w:num> element proxies) for this numbering part."""
    return _NumberingDefinitions(self._element)

_NumberingDefinitions

_NumberingDefinitions(numbering_elm)

Collection of _NumberingDefinition instances corresponding to the <w:num> elements in a numbering part.

Source code in src/docx/parts/numbering.py
def __init__(self, numbering_elm):
    super(_NumberingDefinitions, self).__init__()
    self._numbering = numbering_elm