Skip to content

Phase A.6: Footnote and endnote properties (numbering, restart, position) #17

@loadfix

Description

@loadfix

Add API for configuring footnote and endnote properties at the document and section level. Depends on #1-#5.

Requirement: AGLC4 requires continuous Arabic numeral footnote numbering throughout. MLA endnotes need specific configuration. The numbering format, restart behavior, and position are all configurable in Word but not exposed by python-docx.

API Design

Document-level:

  • document.footnote_properties — FootnoteProperties object
    • .number_format — WD_NUMBER_FORMAT enum (arabic, lowerRoman, upperRoman, lowerLetter, etc.)
    • .start_number — int (default 1)
    • .restart_rule — WD_FOOTNOTE_RESTART enum (continuous, each_section, each_page)
    • .position — WD_FOOTNOTE_POSITION enum (bottom_of_page, below_text)
  • document.endnote_properties — EndnoteProperties object (same shape)
    • .position — WD_ENDNOTE_POSITION enum (end_of_document, end_of_section)

Section-level overrides:

  • section.footnote_properties — per-section override (optional)
  • section.endnote_properties — per-section override (optional)

XML

Document level: w:settings > w:footnotePr and w:endnotePr
Section level: w:sectPr > w:footnotePr and w:endnotePr

Child elements:

  • w:numFmt w:val="decimal" (numbering format)
  • w:numStart w:val="1" (starting number)
  • w:numRestart w:val="continuous" (restart rule: continuous/eachSect/eachPage)
  • w:pos w:val="pageBottom" (position: pageBottom/beneathText for footnotes; docEnd/sectEnd for endnotes)

Files

  • docx/footnotes.py — add FootnoteProperties class
  • docx/endnotes.py — add EndnoteProperties class
  • docx/oxml/footnotes.py — add CT_FtnDocProps, CT_EdnDocProps
  • docx/settings.py — expose footnote/endnote properties
  • docx/section.py — expose per-section overrides

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestphase-aFootnotes & Endnotes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions