lpod.style

class lpod.style.odf_currency_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
class lpod.style.odf_date_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
class lpod.style.odf_font_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
class lpod.style.odf_list_style(native_element)

Bases: lpod.style.odf_style

A list style is a container for list level styles.

get_level_style(level)
get_style_family()
set_level_style(level, type=None, format=None, prefix=None, suffix=None, character=None, uri=None, display_levels=None, start_value=None, style=None, clone=None)
class lpod.style.odf_master_page(native_element)

Bases: lpod.style.odf_style

A master page is the style of a page.

Physical presentation is in the associated page layout.

XXX to verify

Get the element that contains the footer contents.

If None, no footer was set.

get_header()

Get the element that contains the header contents.

If None, no header was set.

get_page_layout_name()
get_style_family()

Create or replace the footer by the given content. It can already be a complete footer.

If you only want to update the existing footer, get it and use the API.

Arguments:

text_or_element – unicode or odf_element or a list of them
set_header(text_or_element)

Create or replace the header by the given content. It can already be a complete header.

If you only want to update the existing header, get it and use the API.

Arguments:

text_or_element – unicode or odf_element or a list of them
set_page_layout_name(name)
set_style_family()
class lpod.style.odf_number_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
class lpod.style.odf_outline_style(native_element)

Bases: lpod.style.odf_list_style

get_style_family()
class lpod.style.odf_page_layout(native_element)

Bases: lpod.style.odf_style

Physical presentation of a page.

XXX to verify

get_header_style()
get_style_family()
set_header_style(new_style)
set_style_family()
class lpod.style.odf_percentage_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
class lpod.style.odf_style(native_element)

Bases: lpod.element.odf_element

Specialised element for styles, yet generic to all style types.

del_style_properties(properties=[], area=None, *args)

Delete the given properties, either by list argument or positional argument (or both). Remove only from the given area, identical to the style family by default.

Arguments:

properties – list

area – str

get_parent_style_name()

Will only return a name, not an object, because we don’t have access to the XML part from here.

See odf_styles.get_parent_style

get_style_display_name()
get_style_family()
get_style_name()
get_style_properties(area=None)

Get the mapping of all properties of this style. By default the properties of the same family, e.g. a paragraph style and its paragraph properties. Specify the area to get the text properties of a paragraph style for example.

Arguments:

area – str

Return: dict

set_background(color=None, uri=None, position='center', repeat=None, opacity=None, filter=None)

Set the background color of a text style, or the background color or image of a paragraph style or page layout.

With no argument, remove any existing background.

The position is one or two of ‘center’, ‘left’, ‘right’, ‘top’ or ‘bottom’.

The repeat is ‘no-repeat’, ‘repeat’ or ‘stretch’.

The opacity is a percentage integer (not a string with the ‘%s’ sign)

The filter is an application-specific filter name defined elsewhere.

Though this method is defined on the base style class, it will raise an error if the style type is not compatible.

Arguments:

color – ‘#rrggbb’

uri – str

position – str

repeat – str

opacity – int

filter – str

set_parent_style_name(name)
set_style_family(family)
set_style_name(name)
set_style_properties(properties={}, style=None, area=None, **kw)

Set the properties of the “area” type of this style. Properties are given either as a dict or as named arguments (or both). The area is identical to the style family by default. If the properties element is missing, it is created.

Instead of properties, you can pass a style with properties of the same area. These will be copied.

Arguments:

properties – dict

style – odf_style

area – ‘paragraph’, ‘text’...

class lpod.style.odf_time_style(native_element)

Bases: lpod.style.odf_style

get_style_family()
lpod.style.odf_create_default_boolean_style()
lpod.style.odf_create_default_currency_style()
lpod.style.odf_create_default_date_style()
lpod.style.odf_create_default_number_style()
lpod.style.odf_create_default_percentage_style()
lpod.style.odf_create_default_time_style()
lpod.style.odf_create_style(family, name=None, display_name=None, parent=None, area=None, color=None, background_color=None, italic=False, bold=False, master_page=None, layout=None, next=None, data_style=None, border=None, border_top=None, border_right=None, border_bottom=None, border_left=None, shadow=None, height=None, use_optimal_height=None, width=None, break_before=None, break_after=None, **kw)

Create a style of the given family. The name is not mandatory at this point but will become required when inserting in a document as a common style.

The display name is the name the user sees in an office application.

The parent is the name of the style this style will inherit from.

To set properties, pass them as keyword arguments. The area properties apply to is optional and defaults to the family.

Arguments:

family – ‘paragraph’, ‘text’, ‘section’, ‘table’, ‘table-column’,
‘table-row’, ‘table-cell’, ‘table-page’, ‘chart’, ‘drawing-page’, ‘graphic’, ‘presentation’, ‘control’, ‘ruby’, ‘list’, ‘number’, ‘page-layout’ ‘font-face’, or ‘master-page’

name – unicode

display_name – unicode

parent – unicode

area – str

‘text’ Properties:

italic – bool

bold – bool

‘paragraph’ Properties:

master_page – unicode

‘master-page’ Properties:

layout – unicode

next – unicode

‘table-cell’ Properties:

border, border_top, border_right, border_bottom, border_left – str, e.g. “0.002cm solid #000000” or ‘none’

shadow – str, e.g. “#808080 0.176cm 0.176cm”

‘table-row’ Properties:

height – str, e.g. ‘5cm’

use_optimal_height – bool

‘table-column’ Properties:

width – str, e.g. ‘5cm’

break_before – ‘page’, ‘column’ or ‘auto’

break_after – ‘page’, ‘column’ or ‘auto’

Return: odf_style

lpod.style.register_style(tagname, cls)