You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document.footnotes, Footnotes.add_footnote() and Run.add_footnote_reference() landed in #34, but the endnote half of the same feature did not. A document's endnotes are unreachable: word/endnotes.xml is never loaded, there is no EndnotesPart, and w:endnoteReference in a run is invisible to the API.
The two are near-identical in the schema — both w:footnote and w:endnote are CT_FtnEdn, both parts are CT_Footnotes/CT_Endnotes wrapping a sequence of those, and w:footnoteReference and w:endnoteReference are both CT_FtnEdnRef. ST_FtnEdn (normal, separator, continuationSeparator) is already in oxml/simpletypes.py and its docstring already says it covers w:endnote/@w:type. CT.WML_ENDNOTES and RT.ENDNOTES are already in opc/constants.py.
So this is mostly a matter of generalising what parts/footnotes.py, oxml/footnotes.py and footnotes.py already do rather than writing a new feature from scratch.
Where the prior art is
br-rkdrnf/python-docx, branches footnotes and bering, has a combined implementation under docx/fntent/ (fntent.py, footnoteReference.py, endnoteReference.py) with docx/oxml/fntent.py and docx/parts/fntent.py, plus default-endnotes.xml and default-footnotes.xml templates. It handles footnotes and endnotes through one code path. It is written against upstream v0.8.7 and predates our footnote work, so it is a design reference rather than something to port.
Shape
EndnotesPart in parts/endnotes.py, alongside FootnotesPart
CT_Endnotes / reuse of CT_FtnEdn in oxml/footnotes.py
Creating the part on demand when the document has none, the way FootnotesPart does
Endnote position and numbering live in w:sectPr/w:endnotePr and w:settings/w:endnotePr, both of which are already in the _tag_seq lists — exposing them is optional follow-up, not part of this
Note that Document.iter_inner_content()'s docstring already mentions endnotes; check what it does today and make it consistent.
Landed in #139. Generalised rather than duplicated: _CT_FtnEdnCollection and _Notes hold the shared behaviour and the two spellings differ only in tag names and styles. Document.replace_text(footnotes=True) now reaches endnotes, which its docstring already claimed. Endnote position in w:endnotePr remains follow-up, as the issue said.
Activity
toxicphreAK commentedon Aug 5, 2026
Landed in #139. Generalised rather than duplicated:
_CT_FtnEdnCollectionand_Noteshold the shared behaviour and the two spellings differ only in tag names and styles.Document.replace_text(footnotes=True)now reaches endnotes, which its docstring already claimed. Endnote position inw:endnotePrremains follow-up, as the issue said.