Skip to content

Style Containers

Classes for styles containers.

Classes:

Name Description
OfficeAutomaticStyles

Container for automatic styles used in the document, “office:automatic-styles”.

OfficeMasterStyles

Container for master styles used in the document, “office:master-styles”.

OfficeAutomaticStyles

Bases: Element

Container for automatic styles used in the document, “office:automatic-styles”.

An automatic style contains formatting properties that are considered to be properties of the object to which the style is assigned.

This element is usable within “office:document”, “office:document-content”, and “office:document-styles” elements, and has no attributes.

Attributes:

Name Type Description
page_layouts list[StylePageLayout]

Return the list of StylePageLayout styles.

Source code in odfdo/style_containers.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class OfficeAutomaticStyles(Element):
    """Container for automatic styles used in the document, "office:automatic-styles".

    An automatic style contains formatting properties that are considered to
    be properties of the object to which the style is assigned.

    This element is usable within "office:document", "office:document-content",
    and "office:document-styles" elements, and has no attributes.
    """

    _tag: str = "office:automatic-styles"

    @property
    def page_layouts(self) -> list[StylePageLayout]:
        """Return the list of StylePageLayout styles.

        Returns:
            A list of StylePageLayout elements.
        """
        return [e for e in self.children if isinstance(e, StylePageLayout)]

_tag class-attribute instance-attribute

_tag: str = 'office:automatic-styles'

page_layouts property

page_layouts: list[StylePageLayout]

Return the list of StylePageLayout styles.

Returns:

Type Description
list[StylePageLayout]

A list of StylePageLayout elements.

OfficeMasterStyles

Bases: Element

Container for master styles used in the document, “office:master-styles”.

A master style contains formatting and other content that is displayed with document content when the style is used.

This element is usable within “office:document” and “office:document-styles” elements, and has no attributes.

Source code in odfdo/style_containers.py
48
49
50
51
52
53
54
55
56
57
58
class OfficeMasterStyles(Element):
    """Container for master styles used in the document, "office:master-styles".

    A master style contains formatting and other content that is displayed with
    document content when the style is used.

    This element is usable within "office:document" and "office:document-styles"
    elements, and has no attributes.
    """

    _tag: str = "office:master-styles"

_tag class-attribute instance-attribute

_tag: str = 'office:master-styles'