footnotes
footnotes
¶
Custom element classes related to document footnotes and endnotes.
Footnotes and endnotes are the same feature in two places. The schema gives both
w:footnote and w:endnote the type CT_FtnEdn, both parts wrap a sequence of those,
and w:footnoteReference and w:endnoteReference are both CT_FtnEdnRef. Only the tag
names and the reference-mark element differ, so this module models the pair once and
subclasses for the two spellings.
_CT_FtnEdnCollection
¶
Bases: BaseOxmlElement
Common behavior of the w:footnotes and w:endnotes root elements.
They differ only in the tag of their children, the reference-mark element that goes
in a new note, and the styles Word applies to one; _tag, _ref_tag,
_para_style and _char_style name those.
note_lst
property
¶
note_lst: List[CT_FtnEdn]
The w:footnote or w:endnote children, in document order.
add_note
¶
add_note() -> CT_FtnEdn
Return a newly added note child of this element.
The returned element is the minimum valid value: a w:id unique among the
existing notes and a single paragraph holding the reference mark that Word
renders as the note number. Content is added by adding runs to that paragraph
and by adding further paragraphs.
Source code in src/docx/oxml/footnotes.py
get_note_by_id
¶
get_note_by_id(note_id: int) -> CT_FtnEdn | None
The note element identified by note_id, or None if not found.
CT_Footnotes
¶
Bases: _CT_FtnEdnCollection
w:footnotes element, the root element for the footnotes part.
Contains a w:footnote element for each footnote in the document, plus the
structural separator footnotes Word keeps at ids -1 and 0.
CT_Endnotes
¶
Bases: _CT_FtnEdnCollection
w:endnotes element, the root element for the endnotes part.
The endnote half of CT_Footnotes; the two are the same complex type in the schema.
CT_FtnEdn
¶
Bases: BaseOxmlElement
w:footnote or w:endnote element, a single note.
A footnote is a "story" and can contain paragraphs and tables much like a table cell, so its content can be rich: multiple paragraphs, hyperlinks, images and tables.
inner_content_elements
property
¶
All w:p and w:tbl elements in this footnote, in document order.
Content inside a w:sdt (content control) wrapper is included.
is_structural
property
¶
True when this is one of Word's separator footnotes rather than an author's.
These are the footnotes Word keeps at ids -1 and 0 to draw the rule above the footnote area and its continuation.