Paper Office
paper-docxAPI referenceoxml.text.pagebreak

CT_LastRenderedPageBreak

paper-docx 0.2.0 API reference

<w:lastRenderedPageBreak> element, indicating page break inserted by renderer.

A rendered page-break is one inserted by the renderer when it runs out of room on a page. It is an empty element (no attrs or children) and is a child of CT_R, peer to CT_Text.

NOTE: this complex-type name does not exist in the schema, where w:lastRenderedPageBreak maps to CT_Empty. This name was added to give it distinguished behavior. CT_Empty is used for many elements.

Attributes

following_fragment_p

attributefollowing_fragment_pCT_P

A "loose" CT_P containing only the paragraph content before this break.

Raises ValueError if this w:lastRenderedPageBreak is not the first rendered page-break in its paragraph.

The returned CT_P is a "clone" (deepcopy) of the w:p ancestor of this page-break with this w:lastRenderedPageBreak element and all content preceding it removed.

NOTE: this w:p can itself contain one or more w:renderedPageBreak elements (when the paragraph contained more than one). While this is rare, the caller should treat this paragraph the same as other paragraphs and split it if necessary in a folloing step or recursion.

follows_all_content

attributefollows_all_contentbool

True when this page-break element is the last "content" in the paragraph.

This is very uncommon case and may only occur in contrived or cases where the XML is edited by hand, but it is not precluded by the spec.

precedes_all_content

attributeprecedes_all_contentbool

True when a w:lastRenderedPageBreak precedes all paragraph content.

This is a common case; it occurs whenever the page breaks on an even paragraph boundary.

preceding_fragment_p

attributepreceding_fragment_pCT_P

A "loose" CT_P containing only the paragraph content before this break.

Raises ValueError if this w:lastRenderedPageBreak is not the first rendered paragraph in its paragraph.

The returned CT_P is a "clone" (deepcopy) of the w:p ancestor of this page-break with this w:lastRenderedPageBreak element and all its following siblings removed.

xml

attributexmlstr

XML string for this element, suitable for testing purposes.

Pretty printed for readability and without an XML declaration at the top.

Functions

first_child_found_in

funcfirst_child_found_in(*tagnames: str) -> _Element | None

First child with tag in tagnames, or None if not found.

paramtagnamesstr
= ()

Returns

lxml.etree._Element | None

insert_element_before

funcinsert_element_before(elm: ElementBase, *tagnames: str)
paramelmElementBase
paramtagnamesstr
= ()

remove_all

funcremove_all(*tagnames: str) -> None

Remove child elements with tagname (e.g. "a:p") in tagnames.

paramtagnamesstr
= ()

Returns

None

xpath

funcxpath(xpath_str: str) -> Any

Override of lxml _Element.xpath() method.

Provides standard Open XML namespace mapping (nsmap) in centralized location.

paramxpath_strstr

Returns

typing.Any

On this page