Section objects¶
Provides access to section properties such as margins and page orientation.
Section objects¶
-
class
docx.section.Section(sectPr)[source]¶ Document section, providing access to section and page setup settings.
-
bottom_margin¶ Lengthobject representing the bottom margin for all pages in this section in English Metric Units.
Lengthobject representing the distance from the bottom edge of the page to the bottom edge of the footer.Noneif no setting is present in the XML.
-
gutter¶ Lengthobject representing the page gutter size in English Metric Units for all pages in this section. The page gutter is extra spacing added to the inner margin to ensure even margins after page binding.
-
header_distance¶ Lengthobject representing the distance from the top edge of the page to the top edge of the header.Noneif no setting is present in the XML.
-
left_margin¶ Lengthobject representing the left margin for all pages in this section in English Metric Units.
-
orientation¶ Member of the WD_ORIENTATION enumeration specifying the page orientation for this section, one of
WD_ORIENT.PORTRAITorWD_ORIENT.LANDSCAPE.
-
page_height¶ Total page height used for this section, inclusive of all edge spacing values such as margins. Page orientation is taken into account, so for example, its expected value would be
Inches(8.5)for letter-sized paper when orientation is landscape.
-
page_width¶ Total page width used for this section, inclusive of all edge spacing values such as margins. Page orientation is taken into account, so for example, its expected value would be
Inches(11)for letter-sized paper when orientation is landscape.
-
right_margin¶ Lengthobject representing the right margin for all pages in this section in English Metric Units.
-
start_type¶ The member of the WD_SECTION_START enumeration corresponding to the initial break behavior of this section, e.g.
WD_SECTION.ODD_PAGEif the section should begin on the next odd page.
-