Content
Representation of the “content.xml” part.
Classes:
| Name | Description |
|---|---|
Content |
Representation of the “content.xml” part. |
Content
Bases: XmlPart
Representation of the “content.xml” part.
Methods:
| Name | Description |
|---|---|
__str__ |
|
get_style |
Return the style uniquely identified by the name/family pair. If the |
get_styles |
Return the list of styles in the Content part, optionally limited to |
Source code in odfdo/content.py
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 | |
__str__
__str__() -> str
Source code in odfdo/content.py
48 49 | |
_get_style_contexts
_get_style_contexts(family: str | None) -> tuple
Source code in odfdo/content.py
40 41 42 43 44 45 46 | |
get_style
get_style(
family: str,
name_or_element: str | Element | None = None,
display_name: str | None = None,
) -> StyleBase | None
Return the style uniquely identified by the name/family pair. If the argument is already a style object, it will return it.
If the name is None, the default style is fetched.
If the name is not the internal name but the name you gave in the desktop application, use display_name instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family
|
str
|
The family of the style to retrieve (e.g., ‘paragraph’, ‘text’, ‘graphic’). |
required |
name_or_element
|
str | Element | None
|
The name of the style or a Style element. If None, the default style for the family is returned. |
None
|
display_name
|
str | None
|
The display name of the style to search for. |
None
|
Returns:
| Type | Description |
|---|---|
StyleBase | None
|
The Style object, or None if not found. |
Source code in odfdo/content.py
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 | |
get_styles
get_styles(family: str | None = None) -> list[StyleBase]
Return the list of styles in the Content part, optionally limited to the given family.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family
|
str | None
|
The style family to filter by. |
None
|
Returns:
| Type | Description |
|---|---|
list[StyleBase]
|
A list of styles. |
Source code in odfdo/content.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |