Document section, providing access to section and page setup settings. Also provides access to headers and footers.
| 22 | |
| 23 | |
| 24 | class Section: |
| 25 | """Document section, providing access to section and page setup settings. |
| 26 | |
| 27 | Also provides access to headers and footers. |
| 28 | """ |
| 29 | |
| 30 | def __init__(self, sectPr: CT_SectPr, document_part: DocumentPart): |
| 31 | super(Section, self).__init__() |
| 32 | self._sectPr = sectPr |
| 33 | self._document_part = document_part |
| 34 | |
| 35 | @property |
| 36 | def bottom_margin(self) -> Length | None: |
| 37 | """Read/write. Bottom margin for pages in this section, in EMU. |
| 38 | |
| 39 | `None` when no bottom margin has been specified. Assigning |None| removes any |
| 40 | bottom-margin setting. |
| 41 | """ |
| 42 | return self._sectPr.bottom_margin |
| 43 | |
| 44 | @bottom_margin.setter |
| 45 | def bottom_margin(self, value: int | Length | None): |
| 46 | self._sectPr.bottom_margin = value |
| 47 | |
| 48 | @property |
| 49 | def different_first_page_header_footer(self) -> bool: |
| 50 | """True if this section displays a distinct first-page header and footer. |
| 51 | |
| 52 | Read/write. The definition of the first-page header and footer are accessed |
| 53 | using :attr:`.first_page_header` and :attr:`.first_page_footer` respectively. |
| 54 | """ |
| 55 | return self._sectPr.titlePg_val |
| 56 | |
| 57 | @different_first_page_header_footer.setter |
| 58 | def different_first_page_header_footer(self, value: bool): |
| 59 | self._sectPr.titlePg_val = value |
| 60 | |
| 61 | @property |
| 62 | def even_page_footer(self) -> _Footer: |
| 63 | """|_Footer| object defining footer content for even pages. |
| 64 | |
| 65 | The content of this footer definition is ignored unless the document setting |
| 66 | :attr:`~.Settings.odd_and_even_pages_header_footer` is set True. |
| 67 | """ |
| 68 | return _Footer(self._sectPr, self._document_part, WD_HEADER_FOOTER.EVEN_PAGE) |
| 69 | |
| 70 | @property |
| 71 | def even_page_header(self) -> _Header: |
| 72 | """|_Header| object defining header content for even pages. |
| 73 | |
| 74 | The content of this header definition is ignored unless the document setting |
| 75 | :attr:`~.Settings.odd_and_even_pages_header_footer` is set True. |
| 76 | """ |
| 77 | return _Header(self._sectPr, self._document_part, WD_HEADER_FOOTER.EVEN_PAGE) |
| 78 | |
| 79 | @property |
| 80 | def first_page_footer(self) -> _Footer: |
| 81 | """|_Footer| object defining footer content for the first page of this section. |
no outgoing calls
searching dependent graphs…