MCPcopy Index your code
hub / github.com/python-openxml/python-docx / numbering_part

Method numbering_part

src/docx/parts/document.py:99–109  ·  view source on GitHub ↗

A |NumberingPart| object providing access to the numbering definitions for this document. Creates an empty numbering part if one is not present.

(self)

Source from the content-addressed store, hash-verified

97
98 @lazyproperty
99 def numbering_part(self) -> NumberingPart:
100 """A |NumberingPart| object providing access to the numbering definitions for this document.
101
102 Creates an empty numbering part if one is not present.
103 """
104 try:
105 return cast(NumberingPart, self.part_related_by(RT.NUMBERING))
106 except KeyError:
107 numbering_part = NumberingPart.new()
108 self.relate_to(numbering_part, RT.NUMBERING)
109 return numbering_part
110
111 def save(self, path_or_stream: str | IO[bytes]):
112 """Save this document to `path_or_stream`, which can be either a path to a

Callers

nothing calls this directly

Calls 3

part_related_byMethod · 0.45
newMethod · 0.45
relate_toMethod · 0.45

Tested by

no test coverage detected