Class WriteStyleFamily

class ooodev.write.style.WriteStyleFamily(owner, component, lo_inst=None)[source]

Bases: StyleFamilyComp, IndexAccessPartial, NameContainerPartial, QiPartial

Represents writer paragraph content.

Contains Enumeration Access.

__init__(owner, component, lo_inst=None)[source]

Constructor

Parameters:
  • owner (WriteDoc) – Owner of this component.

  • component (Any) – UNO object that supports com.sun.star.text.Paragraph service.

  • lo_inst (LoInst, optional) – Lo instance. Defaults to None.

Return type:

None

get_by_index(idx)

Gets the element at the specified index.

Parameters:

idx (int) – The Zero-based index of the element.

Returns:

The element at the specified index.

Return type:

Any

get_by_name(name)

Gets the element with the specified name.

Parameters:

name (str) – The name of the element.

Returns:

The element with the specified name.

Return type:

Any

get_count()

Gets the number of elements contained in the container.

Returns:

The number of elements.

Return type:

int

get_element_names()

Gets the names of all elements contained in the container.

Returns:

The names of all elements.

Return type:

tuple[str, …]

get_element_type()

Gets the type of the elements contained in the container.

Returns:

The type of the elements. None means that it is a multi-type container and you cannot determine the exact types with this interface.

Return type:

Any

get_names()[source]

Gets a sorted list of style family names

Raises:

Exception – If unable to names.

Returns:

List of style names

Return type:

List[str]

get_style(name)[source]

Gets a style by name.

Parameters:

name (str) – Name of style to get.

Raises:

Exception – If unable to get style.

Returns:

Style

Return type:

WriteStyle

has_by_name(name)

Checks if the container has an element with the specified name.

Parameters:

name (str) – The name of the element.

Returns:

True if the container has an element with the specified name, otherwise False.

Return type:

bool

has_elements()

Determines whether the container has elements.

Return type:

bool

insert_by_name(name, element)

Inserts the element with the specified name.

Parameters:
  • name (str) – The name of the element to be inserted.

  • element (T) – The new element.

Return type:

None

qi(atype, raise_err=False)

Generic method that get an interface instance from an object.

Parameters:
  • atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface

  • raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False

Raises:

MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None

Returns:

instance of interface if supported; Otherwise, None

Return type:

T | None

Note

When raise_err=True return value will never be None.

remove_by_name(name)

Removes the element with the specified name.

Parameters:

name (str) – The name of the element to be removed.

Return type:

None

replace_by_name(name, element)

Replaces the element with the specified name.

Parameters:
  • name (str) – The name of the element to be replaced.

  • element (T) – The new element.

Return type:

None

property component: com.sun.star.style.StyleFamily

StyleFamily Component

Return type:

StyleFamily

property owner: WriteDoc

Owner of this component.

Return type:

WriteDoc