Skip to content

NumberingPart.new NotImplementedError #1313

Open
@KaHuier

Description

@KaHuier

the simple code

from docx import Document

doc = Document(r"xxxx.docx")
print(doc.part.numbering_part)

The following issues have occurred

Traceback (most recent call last):
  File "x.py", line 4, in <module>
    print(doc.part.numbering_part)
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\shared.py", line 242, in __get__
    value = self._fget(obj)
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\parts\document.py", line 99, in numbering_part
    numbering_part = NumberingPart.new()
  File "\mars-win-amd64-python3.9\lib\site-packages\docx\parts\numbering.py", line 15, in new
    raise NotImplementedError
NotImplementedError

After investigation, it was found that the 'NumberingPart. new()' used in the 'numbing_part' did not implement the function.

The following is the code used by 'NumberingPart.new()'

class NumberingPart(XmlPart):
    """Proxy for the numbering.xml part containing numbering definitions for a document
    or glossary."""

    @classmethod
    def new(cls):
        """Return newly created empty numbering part, containing only the root
        ``<w:numbering>`` element."""
        raise NotImplementedError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions