Class WriteTextContent

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

Bases: Generic[T], LoInstPropsPartial, TextContentComp, WriteDocPropPartial, QiPartial, ServicePartial, TheDictionaryPartial, StylePartial

Represents writer text content.

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

Constructor

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

  • component (XTextContent) – UNO object that supports com.sun.star.text.TextContent service.

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

Return type:

None

apply_styles(*styles, **kwargs)

Applies style to component.

Parameters:
  • obj. (styles expandable list of styles object such as Font to apply to) –

  • kwargs (Any, optional) – Expandable list of key value pairs.

  • styles (StyleT) –

Return type:

None

attach(text_range)

Attaches a text range to this text content.

Return type:

None

Parameters:

text_range (XTextRange) –

get_anchor()

Returns the anchor of this text content.

Return type:

XTextRange

get_character_properties()[source]

Get character properties.

Returns:

Character properties component or None if not supported.

Return type:

CharacterPropertiesComp | None

get_paragraph_properties()[source]

Get paragraph properties.

Returns:

Paragraph properties or None if not supported.

Return type:

WriteParagraph | None

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

is_text_frame()[source]

Check if this text content is a frame.

Returns:

True if component supports com.sun.star.text.TextFrame service; Otherwise, False.

Return type:

bool

is_text_table()[source]

Check if this text content is a table.

Returns:

True if component supports com.sun.star.text.TextTable service; Otherwise, False.

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.

support_service(*service)

Gets if instance supports a service.

Parameters:

*service (str) – Variable length argument list of UNO namespace strings such as com.sun.star.configuration.GroupAccess

Returns:

True if instance supports any passed in service; Otherwise, False

Return type:

bool

property anchor_type: TextContentAnchorType

Gets/Sets the anchor type of this text content.

Returns:

Anchor Type

Return type:

TextContentAnchorType

Hint

  • TextContentAnchorType``can be imported from ``ooo.dyn.text.text_content_anchor_type.

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

Sheet Cell Cursor Component

Return type:

TextContent

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

Component Owner

Return type:

TypeVar(T, bound= ComponentT)

property text_wrap: WrapTextMode

Gets/Sets if the text content is a shape and how the text is wrapped around the shape.

Returns:

Text Wrap Mode

Return type:

WrapTextMode

Hint

  • WrapTextMode can be imported from ooo.dyn.text.wrap_text_mode

property write_doc: WriteDoc

Write Document.

Return type:

WriteDoc