Class WriteTextRanges

class ooodev.write.WriteTextRanges(owner, component)[source]

Bases: LoInstPropsPartial, IndexAccessComp, WriteDocPropPartial, QiPartial, TheDictionaryPartial

Class for managing Writer Forms.

This class is Enumerable and returns WriteTextCursor instance on iteration.

New in version 0.30.0.

__getitem__(key)[source]

Gets the element at the specified index.

Parameters:

key (int) – The Zero-based index of the element. Key can be a negative value to index from the end of the list. For example, -1 will return the last element.

Returns:

The element at the specified index.

Return type:

WriteTextRange

__init__(owner, component)[source]

Constructor

Parameters:
  • owner (WriteDrawPage) – Owner Component

  • forms (XForms) – Forms instance.

  • lo_inst (LoInst, optional) – Lo instance. Used when creating multiple documents. Defaults to None.

  • component (com.sun.star.container.XIndexAccess) –

Return type:

None

__len__()[source]

Gets the number of Text ranges in this instance.

Returns:

Number of Text ranges.

Return type:

int

__next__()[source]

Gets the next Text Range.

Returns:

Text Range instance.

Return type:

WriteTextRange

get_by_index(idx)[source]

Gets the element at the specified index.

Parameters:

idx (int) – The Zero-based index of the element. Idx can be a negative value to index from the end of the list. For example, -1 will return the last element.

Returns:

The element at the specified index.

Return type:

WriteTextRange

get_count()

Gets the number of elements contained in the container.

Returns:

The number of elements.

Return type:

int

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

has_elements()

Determines whether the container has elements.

Return type:

bool

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.

property component: com.sun.star.container.XIndexAccess

XIndexAccess Component

Return type:

XIndexAccess

property extra_data: TheDict

Extra Data Key Value Pair Dictionary.

Properties can be assigned properties and access like a dictionary and with dot notation.

Note

This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).

This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.

Return type:

TheDict

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property write_doc: WriteDoc

Write Document.

Return type:

WriteDoc