Paper Office
paper-docxAPI referencesection

_Footer

paper-docx 0.2.0 API reference

Page footer, used for all three types (default, even-page, and first-page).

Note that, like a document or table cell, a footer must contain a minimum of one paragraph and a new or otherwise "empty" footer contains a single empty paragraph. This first paragraph can be accessed as footer.paragraphs[0] for purposes of adding content to it. Using :meth:add_paragraph() by itself to add content will leave an empty paragraph above the newly added one.

Attributes

is_linked_to_previous

attributeis_linked_to_previousbool

True if this header/footer uses the definition from the prior section.

False if this header/footer has an explicit definition.

Assigning True to this property removes the header/footer definition for this section, causing it to "inherit" the corresponding definition of the prior section. Assigning False causes a new, empty definition to be added for this section, but only if no definition is already present.

paragraphs

attributeparagraphs

A list containing the paragraphs in this container, in document order.

Read-only.

part

attributepartHeaderPart | FooterPart

The HeaderPart or FooterPart for this header/footer.

This overrides BlockItemContainer.part and is required to support image insertion and perhaps other content like hyperlinks.

tables

attributetables

A list containing the tables in this container, in document order.

Read-only.

Functions

add_paragraph

funcadd_paragraph(text: str = '', style: str | ParagraphStyle | None = None) -> Paragraph

Return paragraph newly added to the end of the content in this container.

The paragraph has text in a single run if present, and is given paragraph style style.

If style is None, no paragraph style is applied, which has the same effect as applying the 'Normal' style.

paramtextstr
= ''
paramstylestr | ParagraphStyle | None
= None

Returns

docx.text.paragraph.Paragraph

add_table

funcadd_table(rows: int, cols: int, width: Length) -> Table

Return table of width having rows rows and cols columns.

The table is appended appended at the end of the content in this container.

width is evenly distributed between the table columns.

paramrowsint
paramcolsint
paramwidthLength

Returns

docx.table.Table

iter_inner_content

funciter_inner_content() -> Iterator[Paragraph | Table]

Generate each Paragraph or Table in this container in document order.

Returns

typing.Iterator[docx.text.paragraph.Paragraph | docx.table.Table]

On this page