Class WriteParagraphs

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

Bases: LoInstPropsPartial, WriteDocPropPartial, TextComp, QiPartial, TheDictionaryPartial, Generic[T]

Represents writer paragraphs.

Contains Enumeration Access.

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

Constructor

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

  • component (XText) – UNO object that supports com.sun.star.text.Text service.

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

Return type:

None

__next__()[source]

Gets the next Paragraph.

Returns:

The next paragraph.

Return type:

WriteParagraph[T]

create_enumeration()

Creates an enumeration of the container’s elements.

Return type:

XEnumeration

create_text_cursor()

Creates a new text cursor.

Returns:

The new text cursor.

Return type:

XTextCursor

create_text_cursor_by_range(text_position)

The initial position is set to text_position.

Parameters:

text_position (XTextRange) – The initial position of the new text cursor.

Returns:

The new text cursor.

Return type:

XTextCursor

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_end()

Returns a text range which contains only the end of this text range.

Return type:

TextRangeComp

get_start()

Returns a text range which contains only the start of this text range.

Return type:

TextRangeComp

get_string()

Returns the string of this text range.

Return type:

str

get_text()

Gets the text of the range.

Returns:

The text of the range.

Return type:

XText

has_elements()

Determines whether the container has elements.

Return type:

bool

insert_control_character(rng, control_character, absorb)

Inserts a control character (like a paragraph break or a hard space) into the text.

Parameters:
  • rng (XTextRange) – The position of the new control character.

  • control_character (ControlCharacterEnum) – The control character to be inserted.

  • absorb (bool) – If TRUE the text range will contain the new inserted control character, otherwise the range (and it’s text) will remain unchanged.

Raises:

IllegalArgumentExceptioncom.sun.star.lang.IllegalArgumentException

Return type:

None

insert_string(rng, text, absorb)

Inserts a string of characters into the text.

The string may contain the following white spaces:

If the parameter bAbsorb() was TRUE the text range will contain the new inserted string, otherwise the range (and it’s text) will remain unchanged.

Return type:

None

Parameters:
  • rng (XTextRange) –

  • text (str) –

  • absorb (bool) –

insert_text_content(rng, content, absorb)

Inserts a content, such as a text table, text frame or text field.

Parameters:
  • rng (XTextRange) – The position at which the content is inserted.

  • content (XTextContent) – The content to be inserted.

  • absorb (bool) – Specifies whether the text spanned by xRange will be replaced. If True then the content of range will be replaced by content, otherwise content will be inserted at the end of xRange.

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_text_content(content)

Removes a text content.

Parameters:

content (XTextContent) – the content that is to be removed.

Return type:

None

set_string(string)

Sets the string of this text range.

The whole string of characters of this piece of text is replaced. All styles are removed when applying this method.

Return type:

None

Parameters:

string (str) –

property component: com.sun.star.text.Text

Text Component

Return type:

Text

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 owner: T

Owner of this component.

Return type:

TypeVar(T, bound= ComponentT)

property write_doc: WriteDoc

Write Document.

Return type:

WriteDoc