-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathsettings.py
More file actions
35 lines (24 loc) · 1.06 KB
/
settings.py
File metadata and controls
35 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Settings object, providing access to document-level settings."""
from __future__ import annotations
from typing import TYPE_CHECKING, cast
from docx.shared import ElementProxy
if TYPE_CHECKING:
import docx.types as t
from docx.oxml.settings import CT_Settings
from docx.oxml.xmlchemy import BaseOxmlElement
class Settings(ElementProxy):
"""Provides access to document-level settings for a document.
Accessed using the :attr:`.Document.settings` property.
"""
def __init__(self, element: BaseOxmlElement, parent: t.ProvidesXmlPart | None = None):
super().__init__(element, parent)
self._settings = cast("CT_Settings", element)
@property
def odd_and_even_pages_header_footer(self) -> bool:
"""True if this document has distinct odd and even page headers and footers.
Read/write.
"""
return self._settings.evenAndOddHeaders_val
@odd_and_even_pages_header_footer.setter
def odd_and_even_pages_header_footer(self, value: bool):
self._settings.evenAndOddHeaders_val = value