CT_SectPr
paper-docx 0.2.0 API reference
w:sectPr element, the container element for section properties.
Attributes
bottom_margin
attributebottom_marginLength | NoneValue of the w:bottom attr of <w:pgMar> child element, as Length.
None when either the element or the attribute is not present.
footer
attributefooterLength | NoneDistance from bottom edge of page to bottom edge of the footer.
This is the value of the w:footer attribute in the w:pgMar child element,
as a Length object, or None if either the element or the attribute is not
present.
footerReference
attributefooterReference= ZeroOrMore('w:footerReference', successors=_tag_seq)get_or_add_pgMar
attributeget_or_add_pgMarCallable[[], CT_PageMar]get_or_add_pgSz
attributeget_or_add_pgSzCallable[[], CT_PageSz]get_or_add_titlePg
attributeget_or_add_titlePgCallable[[], CT_OnOff]get_or_add_type
attributeget_or_add_typeCallable[[], CT_SectType]gutter
attributegutterLength | NoneThe value of the w:gutter attribute in the <w:pgMar> child element,
as a Length object, or None if either the element or the attribute is not
present.
header
attributeheaderLength | NoneDistance from top edge of page to top edge of header.
This value comes from the w:header attribute on the w:pgMar child element.
None if either the element or the attribute is not present.
headerReference
attributeheaderReference= ZeroOrMore('w:headerReference', successors=_tag_seq)left_margin
attributeleft_marginLength | NoneThe value of the w:left attribute in the <w:pgMar> child element, as
a Length object, or None if either the element or the attribute is not
present.
orientation
attributeorientationWD_ORIENTATIONWD_ORIENTATION member indicating page-orientation for this section.
This is the value of the orient attribute on the w:pgSz child, or
WD_ORIENTATION.PORTRAIT if not present.
page_height
attributepage_heightLength | NoneValue in EMU of the h attribute of the w:pgSz child element.
None if not present.
page_width
attributepage_widthLength | NoneValue in EMU of the w attribute of the <w:pgSz> child element.
None if not present.
pgMar
attributepgMarCT_PageMar | None= ZeroOrOne('w:pgMar', successors=(_tag_seq[5:]))pgSz
attributepgSzCT_PageSz | None= ZeroOrOne('w:pgSz', successors=(_tag_seq[4:]))preceding_sectPr
attributepreceding_sectPrCT_SectPr | NoneSectPr immediately preceding this one or None if this is the first.
right_margin
attributeright_marginLength | NoneThe value of the w:right attribute in the <w:pgMar> child element, as
a Length object, or None if either the element or the attribute is not
present.
start_type
attributestart_typeWD_SECTION_STARTThe member of the WD_SECTION_START enumeration corresponding to the value
of the val attribute of the <w:type> child element, or
WD_SECTION_START.NEW_PAGE if not present.
titlePg
attributetitlePgCT_OnOff | None= ZeroOrOne('w:titlePg', successors=(_tag_seq[14:]))titlePg_val
attributetitlePg_valboolValue of w:titlePg/@val or False if ./w:titlePg is not present.
top_margin
attributetop_marginLength | NoneThe value of the w:top attribute in the <w:pgMar> child element, as a
Length object, or None if either the element or the attribute is not
present.
type
attributetypeCT_SectType | None= ZeroOrOne('w:type', successors=(_tag_seq[3:]))xml
attributexmlstrXML string for this element, suitable for testing purposes.
Pretty printed for readability and without an XML declaration at the top.
Functions
add_footerReference
funcadd_footerReference(type_: WD_HEADER_FOOTER, rId: str) -> CT_HdrFtrRefReturn newly added CT_HdrFtrRef element of type_ with rId.
The element tag is w:footerReference.
paramtype_WD_HEADER_FOOTERparamrIdstrReturns
docx.oxml.section.CT_HdrFtrRefadd_headerReference
funcadd_headerReference(type_: WD_HEADER_FOOTER, rId: str) -> CT_HdrFtrRefReturn newly added CT_HdrFtrRef element of type_ with rId.
The element tag is w:headerReference.
paramtype_WD_HEADER_FOOTERparamrIdstrReturns
docx.oxml.section.CT_HdrFtrRefclone
funcclone() -> CT_SectPrReturn an exact duplicate of this <w:sectPr> element tree suitable for
use in adding a section break.
All rsid* attributes are removed from the root <w:sectPr> element.
Returns
docx.oxml.section.CT_SectPrfirst_child_found_in
funcfirst_child_found_in(*tagnames: str) -> _Element | NoneFirst child with tag in tagnames, or None if not found.
paramtagnamesstr= ()Returns
lxml.etree._Element | Noneget_footerReference
funcget_footerReference(type_: WD_HEADER_FOOTER) -> CT_HdrFtrRef | NoneReturn footerReference element of type_ or None if not present.
paramtype_WD_HEADER_FOOTERReturns
docx.oxml.section.CT_HdrFtrRef | Noneget_headerReference
funcget_headerReference(type_: WD_HEADER_FOOTER) -> CT_HdrFtrRef | NoneReturn headerReference element of type_ or None if not present.
paramtype_WD_HEADER_FOOTERReturns
docx.oxml.section.CT_HdrFtrRef | Noneinsert_element_before
funcinsert_element_before(elm: ElementBase, *tagnames: str)paramelmElementBaseparamtagnamesstr= ()iter_inner_content
funciter_inner_content() -> Iterator[CT_P | CT_Tbl]Generate all w:p and w:tbl elements in this section.
Elements appear in document order. Elements shaded by nesting in a w:ins or
other "wrapper" element will not be included.
Returns
typing.Iterator[docx.oxml.text.paragraph.CT_P | docx.oxml.table.CT_Tbl]remove_all
funcremove_all(*tagnames: str) -> NoneRemove child elements with tagname (e.g. "a:p") in tagnames.
paramtagnamesstr= ()Returns
Noneremove_footerReference
funcremove_footerReference(type_: WD_HEADER_FOOTER) -> strReturn rId of w:footerReference child of type_ after removing it.
paramtype_WD_HEADER_FOOTERReturns
strremove_headerReference
funcremove_headerReference(type_: WD_HEADER_FOOTER)Return rId of w:headerReference child of type_ after removing it.
paramtype_WD_HEADER_FOOTERxpath
funcxpath(xpath_str: str) -> AnyOverride of lxml _Element.xpath() method.
Provides standard Open XML namespace mapping (nsmap) in centralized location.
paramxpath_strstrReturns
typing.Any