Paper Office
paper-docxAPI referencenotes

docx.notes

paper-docx 0.2.0 API reference

Create footnotes and endnotes, including the note body and the mark.

add_endnote

funcadd_endnote(document: 'Document', span: 'Span', text: str) -> int

Attach an endnote to span and return its note id.

Creates the endnotes part on first use. Same refusals as add_footnote: protection, a stale or foreign span, a span outside the main body, and one inside a text box, a field result, or a data-bound, locked or plain-text control.

paramdocument'Document'
paramspan'Span'
paramtextstr

Returns

int

add_footnote

funcadd_footnote(document: 'Document', span: 'Span', text: str) -> int

Attach a footnote to span and return its note id.

Creates the footnotes part on first use. Refuses a protected document, a stale or foreign span, a span outside the main body, and one inside a text box, a field result, or a data-bound, locked or plain-text control.

paramdocument'Document'
paramspan'Span'
paramtextstr

Returns

int

check_install

funccheck_install() -> None

Refuse when paper-docx and python-docx are both installed.

Returns

None

require_span_owner

funcrequire_span_owner(document: 'Document', span: 'Span', *, argument: str = 'span') -> None

Refuse a live span captured from a different document package.

paramdocument'Document'
paramspan'Span'
paramargumentstr
= 'span'

Returns

None

rollback_on_error

funcrollback_on_error(document: 'Document', *participants: Any) -> Generator[None, None, None]

Restore the live package and named mutable proxies after an error.

paramdocument'Document'
paramparticipantsAny
= ()

Returns

typing.Generator[None, None, None]

On this page