Page Layout
Classes related to “style:page-layout”.
Classes:
| Name | Description |
|---|---|
StylePageLayout |
The “style:page-layout” element represents the styles that specify the |
StylePageLayout
Bases: StyleProps
The “style:page-layout” element represents the styles that specify the formatting properties of a page.
The “style:page-layout” element is usable within the following element: “office:automatic-styles”.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a StylePageLayout element. |
__repr__ |
|
del_properties |
Delete specific properties from the page-layout. |
get_footer_style |
Get the |
get_header_style |
Get the |
get_properties |
Retrieve the page-layout properties of the |
set_background |
Set the background properties for the page layout. |
set_footer_style |
Set or replace the |
set_header_style |
Set or replace the |
set_properties |
Set the properties for the page-layout. |
Attributes:
| Name | Type | Description |
|---|---|---|
PAGE_USAGE |
ClassVar
|
|
family |
str | None
|
Get the family of the style. |
name |
|
|
page_usage |
str
|
Get the |
Source code in odfdo/page_layout.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
PAGE_USAGE
class-attribute
instance-attribute
PAGE_USAGE: ClassVar = {'all', 'left', 'right', 'mirrored'}
_family
instance-attribute
_family = 'page-layout'
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "style:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'style:page-layout'
family
property
writable
family: str | None
Get the family of the style.
For StylePageLayout, this is always “page-layout”.
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The family name. |
name
instance-attribute
name = name
page_usage
property
writable
page_usage: str
Get the style:page-usage attribute.
Specifies the type of pages that a page master should generate.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The page usage type. Defaults to “all”. |
__init__
__init__(
name: str | None = None,
page_usage: str | None = None,
**kwargs: Any,
) -> None
Initialize a StylePageLayout element.
The name is not mandatory at creation but becomes required when
inserting into a document as an automatic style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the page layout style. |
None
|
page_usage
|
str | None
|
The type of pages the layout applies to. Allowed values are “all” (default), “left”, “mirrored”, “right”. |
None
|
**kwargs
|
Any
|
Additional keyword arguments for the parent |
{}
|
Source code in odfdo/page_layout.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
__repr__
__repr__() -> str
Source code in odfdo/page_layout.py
96 97 | |
del_properties
del_properties(
properties: list[str] | None = None,
area: str | None = None,
) -> None
Delete specific properties from the page-layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
properties
|
list[str] | None
|
A list of property names to delete. |
None
|
area
|
str | None
|
The area from which to delete properties. (Parameter is kept for compatibility but internally fixed to “page-layout”). |
None
|
Source code in odfdo/page_layout.py
157 158 159 160 161 162 163 164 165 166 167 168 169 | |
get_footer_style
get_footer_style() -> StyleBase | None
Get the style:footer-style element within the page layout.
Returns:
| Type | Description |
|---|---|
StyleBase | None
|
StyleBase | None: The |
Source code in odfdo/page_layout.py
219 220 221 222 223 224 225 226 | |
get_header_style
get_header_style() -> StyleBase | None
Get the style:header-style element within the page layout.
Returns:
| Type | Description |
|---|---|
StyleBase | None
|
StyleBase | None: The |
Source code in odfdo/page_layout.py
199 200 201 202 203 204 205 206 | |
get_properties
get_properties(
area: str | None = "page-layout",
) -> PropDict | None
Retrieve the page-layout properties of the StylePageLayout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
str | None
|
The area for which to retrieve properties. (Parameter is kept for compatibility but internally fixed to “page-layout”). |
'page-layout'
|
Returns:
| Type | Description |
|---|---|
PropDict | None
|
dict[str, str | dict] | None: A dictionary mapping property names to their values. |
Source code in odfdo/page_layout.py
122 123 124 125 126 127 128 129 130 131 132 | |
set_background
set_background(
color: str | None = None,
url: str | None = None,
position: str | None = "center",
repeat: str | None = None,
opacity: str | int | None = None,
filter: str | None = None,
) -> None
Set the background properties for the page layout.
This can configure a background color or an image. If no arguments are provided, any existing background is removed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
str | None
|
The background color in ‘#RRGGBB’ format. |
None
|
url
|
str | None
|
The URL of a background image. |
None
|
position
|
str | None
|
The position of the background image. Can be “left”, “center”, “right”, “top”, “bottom”, or a combination of two (e.g., “top center”). Defaults to “center”. |
'center'
|
repeat
|
str | None
|
How the background image repeats. Can be “no-repeat”, “repeat”, or “stretch”. |
None
|
opacity
|
str | int | None
|
The opacity of the background image as a percentage integer (0-100). |
None
|
filter
|
str | None
|
An application-specific filter name for the background image. |
None
|
Source code in odfdo/page_layout.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
set_footer_style
set_footer_style(new_style: StyleBase) -> None
Set or replace the style:footer-style element within the page layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_style
|
StyleBase
|
The new footer style to set. |
required |
Source code in odfdo/page_layout.py
228 229 230 231 232 233 234 235 236 237 | |
set_header_style
set_header_style(new_style: StyleBase) -> None
Set or replace the style:header-style element within the page layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_style
|
StyleBase
|
The new header style to set. |
required |
Source code in odfdo/page_layout.py
208 209 210 211 212 213 214 215 216 217 | |
set_properties
set_properties(
properties: PropDict | None = None,
style: StyleBase | None = None,
area: str | None = None,
**kwargs: Any,
) -> None
Set the properties for the page-layout.
Properties can be provided either as a dictionary, as a StyleBase object,
or as keyword arguments. The area is internally fixed to “page-layout”.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
properties
|
PropDict | None
|
A dictionary of properties to set. |
None
|
style
|
StyleBase | None
|
A |
None
|
area
|
str | None
|
The area for which to set properties. (Parameter is kept for compatibility but internally fixed to “page-layout”). |
None
|
**kwargs
|
Any
|
Additional keyword arguments for properties to set. |
{}
|
Source code in odfdo/page_layout.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |