Class WriteTextCursor
- class ooodev.write.WriteTextCursor(owner, component, lo_inst=None)[source]
Bases:
LoInstPropsPartial
,WriteDocPropPartial
,EventsPartial
,TextCursorPartial
[T
],Generic
[T
],TextCursorComp
,ParagraphCursorPartial
,SentenceCursorPartial
,WordCursorPartial
,CharacterPropertiesPartial
,ParagraphPropertiesPartial
,PropertyChangeImplement
,VetoableChangeImplement
,PropPartial
,QiPartial
,TheDictionaryPartial
,StylePartial
Represents a writer text cursor.
This class implements
__len__()
method, which returns the number of characters in the range.- __init__(owner, component, lo_inst=None)[source]
Constructor
- Parameters:
owner (T) – Owner of this component.
component (XTextCursor) – A UNO object that supports
com.sun.star.text.TextCursor
service.lo_inst (LoInst, optional) – Lo instance. Defaults to
None
.
- Return type:
None
- add_bookmark(name)
Adds a bookmark with the specified name to the cursor.
- Parameters:
name (str) – Bookmark name
- Returns:
True if bookmark is added; Otherwise, False
- Return type:
bool
- Events:
Note
Event args
event_data
is a dictionary containingname
andcursor
.
- add_event_observers(*args)
Adds observers that gets their
trigger
method called when this classtrigger
method is called.- Parameters:
args (EventObserver) – One or more observers to add.
- Return type:
None
Note
Observers are removed automatically when they are out of scope.
- add_event_property_change(name, cb)
Adds a listener for an event.
Event is invoked when property is changed.
The callback
EventArgs.event_data
will contain acom.sun.star.beans.PropertyChangeEvent
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_property_change_events_disposing(name, cb)
Adds a listener for an event.
Event is invoked when the property listener is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_vetoable_change(name, cb)
Adds a listener for an event.
Event is invoked when property is changed.
The callback
EventArgs.event_data
will contain acom.sun.star.beans.PropertyChangeEvent
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_vetoable_change_events_disposing(name, cb)
Adds a listener for an event.
Event is invoked when the property listener is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_formula(formula, styles=None)
Adds a formula
- Parameters:
formula (str) – formula
styles (Sequence[StyleT]) – One or more styles to apply to frame. Only styles that support
com.sun.star.text.TextEmbeddedObject
service are applied.
- Raises:
CreateInstanceMsfError – If unable to create text.TextEmbeddedObject
CancelEventError – If event
WriteNamedEvent.FORMULA_ADDING
is cancelledException – If unable to add formula
- Returns:
Embedded Object.
- Return type:
- Events:
Hint
Styles that can be applied are found in the following packages.
Note
Event args
event_data
is a dictionary containingformula
andcursor
.
- add_hyperlink(label, url_str)
Add a hyperlink
- Parameters:
label (str) – Hyperlink label
url_str (str) – Hyperlink url
- Raises:
CreateInstanceMsfError – If unable to create TextField.URL instance
Exception – If unable to create hyperlink
- Returns:
True if hyperlink is added; Otherwise, False
- Return type:
bool
- Events:
Note
Event args
event_data
is a dictionary containinglabel
,url_str
andcursor
.
- add_image_link(fnm, *, width=0, height=0, styles=None)
Add Image Link
- Parameters:
fnm (PathOrStr) – Image path
width (int, UnitT) – Width in
1/100th mm
or Class UnitT.height (int, UnitT) – Height in
1/100th mm
or Class UnitT.styles (Sequence[StyleT]) – One or more styles to apply to frame. Only styles that support
com.sun.star.text.TextGraphicObject
service are applied.
- Raises:
CreateInstanceMsfError – If Unable to create text.TextGraphicObject.
MissingInterfaceError – If unable to obtain XPropertySet interface.
Exception – If unable to add image.
CancelEventError – If
IMAGE_LINK_ADDING
event is canceled.
- Returns:
Image Link on success; Otherwise,
None
.- Return type:
XTextContent
- Events:
Hint
Styles that can be applied are found in the following packages.
Note
Event args
event_data
is a dictionary containingdoc
,cursor
,fnm
,width
andheight
.
- add_image_shape(fnm, width=0, height=0)
Add Image Shape.
- Parameters:
fnm (PathOrStr) – Image path.
width (int, UnitT) – Width in
1/100th mm
or Class UnitT.height (int, UnitT) – Height in
1/100th mm
or Class UnitT.
- Raises:
CreateInstanceMsfError – If unable to create drawing.GraphicObjectShape.
ValueError – If unable to get image.
MissingInterfaceError – If require interface cannot be obtained.
Exception – If unable to add image shape.
CancelEventError – if
IMAGE_SHAPE_ADDING
event is canceled.
- Returns:
Image Shape on success; Otherwise,
None
.- Return type:
- Events:
Note
Event args
event_data
is a dictionary containingdoc
,cursor
,fnm
,width
andheight
.
- add_line_divider(line_width)
Adds a line divider
- Parameters:
line_width (int) – Line width
- Raises:
CreateInstanceMsfError – If unable to create drawing.LineShape instance
MissingInterfaceError – If unable to obtain XShape interface
Exception – If unable to add Line divider
- Return type:
None
- add_table(table_data, *, name='', header_bg_color=None, header_fg_color=None, tbl_bg_color=None, tbl_fg_color=None, first_row_header=True, styles=None)
Adds a table.
Each row becomes a row of the table. The first row is treated as a header.
- Parameters:
table_data (Table) – 2D Table with the the first row containing column names.
name (str, optional) – Table name.
header_bg_color (
Color
, optional) – Table header background color. Set to None to ignore header color. Defaults toNone
.header_fg_color (
Color
, optional) – Table header foreground color. Set to None to ignore header color. Defaults to Defaults to ``None`.tbl_bg_color (
Color
, optional) – Table background color. Set to None to ignore background color. Defaults toNone
.tbl_fg_color (
Color
, optional) – Table background color. Set to None to ignore background color. Defaults toNone
.first_row_header (bool, optional) – If
True
First row is treated as header data. DefaultTrue
.styles (Sequence[StyleT], optional) – One or more styles to apply to frame. Only styles that support
com.sun.star.text.TextTable
service are applied.
- Raises:
ValueError – If table_data is empty
CreateInstanceMsfError – If unable to create instance of text.TextTable
CancelEventError – If
WriteNamedEvent.TABLE_ADDING
event cancelledException – If unable to add table
- Returns:
Table that is added to document.
- Return type:
- Events:
Note
Event args
event_data
is a dictionary containing all method args.Hint
Styles that can be applied are found in ooodev.format.writer.direct.table subpackages.
- add_text_frame(*, text='', ypos=300, width=5000, height=5000, page_num=1, border_color=None, background_color=None, styles=None)
Adds a text frame.
- Parameters:
text (str, optional) – Frame Text
ypos (int, UnitT. optional) – Frame Y pos in
1/100th mm
or Class UnitT. Default300
.width (int, UnitT, optional) – Width in
1/100th mm
or Class UnitT.height (int, UnitT, optional) – Height in
1/100th mm
or Class UnitT.page_num (int, optional) – Page Number to add text frame. If
0
Then Frame is anchored to paragraph. Default1
.border_color (
Color
, optional) – .color.Color`, optional): Border Color.background_color (
Color
, optional) – Background Color.styles (Sequence[StyleT]) – One or more styles to apply to frame. Only styles that support
com.sun.star.text.TextFrame
service are applied.
- Raises:
CreateInstanceMsfError – If unable to create text.TextFrame
CancelEventError – If
WriteNamedEvent.TEXT_FRAME_ADDING
event is cancelledException – If unable to add text frame
- Returns:
Text frame that is added to document.
- Return type:
- Events:
Hint
Styles that can be applied are found in ooodev.format.writer.direct.frame subpackages.
Note
Event args
event_data
is a dictionary containing all method args.See also
- append(*args, **kwargs)
Append content to cursor
- Parameters:
text (str) – Text to append.
styles (Sequence[StyleT]) – One or more styles to apply to text.
ctl_char (int) – Control Char (like a paragraph break or a hard space).
text_content (XTextContent) – Text content, such as a text table, text frame or text field.
- Return type:
None
- Events:
If using styles then the following events are triggered for each style.
Hint
Styles that can be applied are found in the following packages.
See also
- append_date_time()
Append two DateTime fields, one for the date, one for the time
- Raises:
MissingInterfaceError – If required interface cannot be obtained.
- Return type:
None
- append_line(text='', styles=None)
Appends a new Line.
- Parameters:
text (str, optional) – text to append before new line is inserted.
styles (Sequence[StyleT]) – One or more styles to apply to text. If
text
is omitted then this argument is ignored.
- Return type:
None
- Events:
If using styles then the following events are triggered for each style.
- append_para(text='', styles=None)
Appends text (if present) and then a paragraph break.
- Parameters:
text (str, optional) – Text to append
styles (Sequence[StyleT]) – One or more styles to apply to text. If
text
is empty then this argument is ignored.
- Return type:
None
- Events:
If using styles then the following events are triggered for each style.
Hint
Styles that can be applied are found in the following packages.
- 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
- collapse_to_end()
Sets the end of the position to the start.
- Return type:
None
- collapse_to_start()
Sets the start of the position to the end.
- Return type:
None
- column_break()
Inserts a column break
- Return type:
None
- end_line()
Inserts a line break
- Return type:
None
- end_paragraph()
Inserts a paragraph break
- Return type:
None
- get_all_text()
Gets the text part of the document
- Returns:
text
- Return type:
str
- get_end()
Returns a text range which contains only the end of this text range.
- Return type:
- get_pos()
Gets position of the cursor
- Parameters:
cursor (XTextCursor) – Text Cursor
- Returns:
Current Cursor Position
- Return type:
int
Note
This method is not the most reliable. It attempts to read all the text in a document and move the cursor to the end and then get the position.
It would be better to use cursors from relative positions in bigger documents.
- get_property(name, default=<object object>)
Get property value
- Parameters:
name (str) – Property Name.
default (Any, optional) – Return value if property value is
None
.
- Returns:
Property value or default.
- Return type:
Any
- get_start()
Returns a text range which contains only the start of this text range.
- Return type:
- 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
- get_write_text()[source]
Gets the WriteText (XText Component) object from the cursor.
- Returns:
WriteText object
- Return type:
- go_left(count, expand=False)
Moves the cursor left by the given number of units.
- Parameters:
count (int) – Number of units to move.
expand (bool, optional) –
True
to expand the selection. Defaults toFalse
.
- Returns:
True
if the cursor was moved left,False
otherwise.- Return type:
bool
Note
Even if the command was not completed successfully it may be completed partially. E.g. if it was required to move 5 characters but it is only possible to move 3 FALSE will be returned and the cursor moves only those 3 characters.
- go_right(count, expand=False)
Moves the cursor right by the given number of units.
- Parameters:
count (int) – Number of units to move.
expand (bool, optional) –
True
to expand the selection. Defaults toFalse
.
- Returns:
True
if the cursor was moved right,False
otherwise.- Return type:
bool
Note
Even if the command was not completed successfully it may be completed partially. E.g. if it was required to move 5 characters but it is only possible to move 3 FALSE will be returned and the cursor moves only those 3 characters.
- goto_end(expand=False)
Moves the cursor to the end of the document.
- Parameters:
expand (bool, optional) –
True
to expand the selection. Defaults toFalse
.- Return type:
None
- goto_end_of_paragraph(expand=False)
Moves the cursor to the end of the current paragraph.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the end of the paragraph. Default isFalse
.- Returns:
True
if the cursor is now at the end of a paragraph,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_end_of_sentence(expand=False)
Moves the cursor to the end of the sentence.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the end of the sentence. Default isFalse
.- Returns:
True
if the cursor is now at the end of a sentence,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_end_of_word(expand=False)
Moves the cursor to the end of the current word.
- Parameters:
expand (bool, optional) – If
True
, the selection is expanded to the end of the word. Defaults toFalse
.- Returns:
True
if the cursor is moved,False
otherwise.- Return type:
bool
- goto_next_paragraph(expand=False)
Moves the cursor to the next paragraph.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the next paragraph. Default isFalse
.- Returns:
True
if the cursor is now at the start of a paragraph,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_next_sentence(expand=False)
Moves the cursor to the next sentence.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the next sentence. Default isFalse
.- Returns:
True
if the cursor is now at the start of a sentence,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_next_word(expand=False)
Moves the cursor to the next word.
- Parameters:
expand (bool, optional) – If
True
, the selection is expanded to the end of the word. Defaults toFalse
.- Returns:
True
if the cursor is moved,False
otherwise.- Return type:
bool
Note
The function returning
True
does not necessarily mean that the cursor is located at the next word, or any word at all! This may happen for example if it travels over empty paragraphs.
- goto_previous_paragraph(expand=False)
Moves the cursor to the previous paragraph.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the previous paragraph. Default isFalse
.- Returns:
True
if the cursor is now at the start of a paragraph,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_previous_sentence(expand=False)
Moves the cursor to the previous sentence.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the previous sentence. Default isFalse
.- Returns:
True
if the cursor is now at the start of a sentence,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_previous_word(expand=False)
Moves the cursor to the previous word.
- Parameters:
expand (bool, optional) – If
True
, the selection is expanded to the start of the word. Defaults toFalse
.- Returns:
True
if the cursor is moved,False
otherwise.- Return type:
bool
Note
The function returning
True
does not necessarily mean that the cursor is located at the previous word, or any word at all! This may happen for example if it travels over empty paragraphs.
- goto_range(range, expand=False)
Moves or expands the cursor to a specified TextRange.
- Parameters:
range (XTextRange) – Range to move to.
expand (bool, optional) –
True
to expand the selection. Defaults toFalse
.
- Return type:
None
- goto_start(expand=False)
Moves the cursor to the start of the document.
- Parameters:
expand (bool, optional) –
True
to expand the selection. Defaults toFalse
.- Return type:
None
- goto_start_of_paragraph(expand=False)
Moves the cursor to the start of the current paragraph.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the start of the paragraph. Default isFalse
.- Returns:
True
if the cursor is now at the start of a paragraph,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_start_of_sentence(expand=False)
Moves the cursor to the start of the sentence.
- Parameters:
expand (bool, optional) – If
True
the range of the cursor will be expanded to the start of the sentence. Default isFalse
.- Returns:
True
if the cursor is now at the start of a sentence,False
otherwise. IfFalse
is returned the cursor will remain at its original position.- Return type:
bool
- goto_start_of_word(expand=False)
Moves the cursor to the start of the current word.
- Parameters:
expand (bool, optional) – If
True
, the selection is expanded to the start of the word. Defaults toFalse
.- Returns:
True
if the cursor is moved,False
otherwise.- Return type:
bool
- insert_para(para, para_style)
Inserts a paragraph with a style applied
- Parameters:
para (str) – Paragraph text
para_style (str) – Style such as ‘Heading 1’
- Return type:
None
- is_collapsed()
Returns
True
if the cursor is collapsed.- Return type:
bool
- is_end_of_paragraph()
Returns true if the cursor is at the end of a paragraph.
- Returns:
True
if the cursor is at the end of a paragraph.- Return type:
bool
- is_end_of_sentence()
Returns true if the cursor is at the end of a sentence.
- Returns:
True
if the cursor is at the end of a sentence.- Return type:
bool
- is_end_of_word()
Returns True if the cursor is at the end of a word.
- Return type:
bool
- is_start_of_paragraph()
Returns true if the cursor is at the start of a paragraph.
- Returns:
True
if the cursor is at the start of a paragraph.- Return type:
bool
- is_start_of_sentence()
Returns true if the cursor is at the start of a sentence.
- Returns:
True
if the cursor is at the start of a sentence.- Return type:
bool
- is_start_of_word()
Returns True if the cursor is at the start of a word.
- Return type:
bool
- page_break()
Inserts a page break
- 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 beNone
.
- remove_event_observer(observer)
Removes an observer
- Parameters:
observer (EventObserver) – One or more observers to add.
- Returns:
True
if observer has been removed; Otherwise,False
.- Return type:
bool
- remove_event_property_change(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_property_change_events_disposing(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_vetoable_change(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_vetoable_change_events_disposing(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- set_property(**kwargs)
Set property value
- Parameters:
**kwargs (
Any
) – Variable length Key value pairs used to set properties.- 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) –
- style(**kwargs)
Styles. From position styles right by distance amount.
- Parameters:
pos (int) – Position style start.
length (int) – The distance from
pos
to apply style.styles (Sequence[StyleT]) – One or more styles to apply to text.
prop_name (str) – Property Name such as
CharHeight
prop_val (object) – Property Value such as
10
- Return type:
None
See also
style_left()
Note
Unlike
style_left()
this method does not restore any style properties after style is applied.
- style_left(*args, **kwargs)
Styles left. From current cursor position to left by pos amount.
- Parameters:
pos (int) – Positions to style left
styles (Sequence[StyleT]) – One or more styles to apply to text.
prop_name (str) – Property Name such as
CharHeight
prop_val (object) – Property Value such as
10
- Return type:
None
- Events:
If using styles then the following events are triggered for each style.
Otherwise, the following events are triggered once.
See also
style()
Note
This method restores the style properties to their original state after the style is applied. This is done so applied style properties are reset before next text is appended. This is not the case for
style()
method.
- style_left_bold(pos)
Styles bold from current cursor position left by pos amount.
- Parameters:
pos (int) – Number of positions to go left
- Return type:
None
- style_left_code(pos)
Styles using a Mono font from current cursor position left by pos amount. Font Char Height is set to
10
- Parameters:
pos (int) – Number of positions to go left
- Return type:
None
Note
The font applied is determined by
Info.get_font_mono_name()
- style_left_color(pos, color)
Styles color from current cursor position left by pos amount.
- Parameters:
pos (int) – Number of positions to go left
color (Color) – RGB color as int to apply
- Return type:
None
See also
- style_left_italic(pos)
Styles italic from current cursor position left by pos amount.
- Parameters:
pos (int) – Number of positions to go left
- Return type:
None
- style_prev_paragraph(styles: Sequence[ooodev.proto.style_obj.StyleT])[source]
- style_prev_paragraph(prop_val: Any)
- style_prev_paragraph(prop_val: Any, prop_name: str)
- style_prev_paragraph(*args, **kwargs)
Style previous paragraph.
- Parameters:
styles (Sequence[StyleT]) – One or more styles to apply to text.
prop_val (Any) – Property value.
prop_name (str) – Property Name.
- Events:
If using styles then the following events are triggered for each style.
Otherwise the following events are triggered once.
- Return type:
None
Example
doc.style_prev_paragraph(prop_val=ParagraphAdjust.CENTER, prop_name="ParaAdjust")
- subscribe_event(event_name, callback)
Add an event listener to current instance.
- Parameters:
event_name (str) – Event Name.
callback (EventCallback) – Callback of the event listener.
- Return type:
None
- trigger_event(event_name, event_args)
Trigger an event on current instance.
- Parameters:
event_name (str) – Event Name.
event_args (EventArgsT) – Event Args.
- Return type:
None
- unsubscribe_event(event_name, callback)
Remove an event listener from current instance.
- Parameters:
event_name (str) – Event Name.
callback (EventCallback) – Callback of the event listener.
- Return type:
None
- property border_distance: UnitMM100 | None
Gets/Sets the distance from the border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property bottom_border: BorderLine2StructComp | None
Gets/Sets the bottom border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property bottom_border_distance: UnitMM100 | None
Gets/Sets the distance from the bottom border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property break_type: BreakType | None
Gets/Sets the type of break that is applied at the beginning of the table.
optional
- Returns:
Returns BreakType or None if not supported.
- Return type:
BreakType | None
Hint
BreakType
can be imported fromooo.dyn.style.break_type
- property char_auto_kerning: bool | None
Gets/Sets - This optional property determines whether the kerning tables from the current font are used.
Automatic kerning applies a spacing in between certain pairs of characters to make the text look better.
Optional
- Return type:
bool | None
- property char_back_color: Color | None
Get/Sets - This optional property contains the text background color.
Optional
- Returns:
Color or None if not supported.
- Return type:
Color | None
- property char_back_transparent: bool | None
Gets/Sets if the text background color is set to transparent.
Optional
- Return type:
bool | None
- property char_border_distance: UnitMM100 | None
Gets/Sets the distance from the border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.Optional
- Return type:
UnitMM100 | None
- property char_bottom_border: BorderLine2StructComp | None
This property contains the bottom border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property char_bottom_border_distance: UnitMM100 | None
This property contains the distance from the bottom border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property char_case_map: int | None
Gets/Sets - This optional property contains the value of the case-mapping of the text for formatting and displaying.
optional
- Return type:
int | None
- property char_color: Color
This property contains the value of the text color.
- Returns:
Color
- Return type:
- property char_color_theme: int | None
Gets/Sets - If available, keeps the color theme index, so that the character can be re-colored easily based on a theme.
since
LibreOffice
7.3
optional
- Return type:
int | None
- property char_color_tint_or_shade: int | None
Gets/Sets the tint or shade of the character color.
since
LibreOffice
7.3
optional
- Return type:
int | None
- property char_combine_is_on: bool | None
Gets/Sets - This optional property determines whether text is formatted in two lines.
It is linked to the properties
char_combine_prefix
andchar_combine_suffix
.optional
- Return type:
bool | None
- property char_combine_prefix: str | None
Gets/Sets - This optional property contains the prefix (usually parenthesis) before text that is formatted in two lines.
It is linked to the properties
char_combine_is_on
andchar_combine_suffix
.optional
- Return type:
str | None
- property char_combine_suffix: str | None
Gets/Sets - This optional property contains the suffix (usually parenthesis) after text that is formatted in two lines.
It is linked to the properties CharCombineIsOn and CharCombinePrefix.
optional
- Return type:
str | None
- property char_contoured: bool | None
Gets/Sets - This optional property specifies if the characters are formatted and displayed with a contour effect.
optional
- Return type:
bool | None
- property char_crossed_out: bool | None
Gets/Sets - This property is
True
if the characters are crossed out.optional
- Return type:
bool | None
- property char_emphasis: int | None
Gets/Sets - This optional property contains the font emphasis value.
optional
- Return type:
int | None
- property char_escapement: int | None
Gets/Sets the percentage by which to raise/lower superscript/subscript characters.
Negative values denote subscripts and positive values superscripts.
optional
- Return type:
int | None
- property char_escapement_height: int | None
Gets/Sets - This is the relative height used for subscript or superscript characters in units of percent.
The value 100 denotes the original height of the characters.
optional
- Return type:
int | None
- property char_flash: bool | None
Gets/Sets - If this optional property is
True
, then the characters are flashing.optional
- Return type:
bool | None
- property char_font_char_set: int
Gets/Sets - This property contains the text encoding of the font.
- Return type:
int
- property char_font_family: int
Get/Sets the font family.
- Return type:
int
- property char_font_name: str
Gets/Sets the name of the font style.
It may contain more than one name separated by comma.
- Return type:
str
- property char_font_pitch: int
Gets/Sets the font pitch.
- Return type:
int
- property char_font_style_name: str
Gets/Sets the name of the font style.
This property may be empty.
- Return type:
str
- property char_font_type: int | None
Gets/Sets - This optional property specifies the fundamental technology of the font.
optional
- Return type:
int | None
- property char_height: UnitPT
Gets/Sets - This value contains the height of the characters in point.
When setting the value can be a float (in points) or a
UnitT
instance.- Return type:
Gets/Sets - If this optional property is
True
, then the characters are invisible.optional
- Return type:
bool | None
- property char_highlight: Color | None
Gets/Sets the color of the highlight.
optional
- Returns:
Color
- Return type:
- property char_interop_grab_bag: Tuple[PropertyValue, ...] | None
Gets/Sets grab bag of character properties, used as a string-any map for interim interop purposes.
This property is intentionally not handled by the ODF filter. Any member that should be handled there should be first moved out from this grab bag to a separate property.
Optional
- Return type:
Tuple[PropertyValue, …] | None
- property char_keep_together: bool | None
Gets/Sets - This optional property marks a range of characters to prevent it from being broken into two lines.
A line break is applied before the range of characters if the layout makes a break necessary within the range.
optional
- Return type:
bool | None
- property char_kerning: int | None
Gets/Sets - This optional property contains the value of the kerning of the characters.
optional
- Return type:
int | None
- property char_left_border: BorderLine2StructComp | None
Gets/Sets - This property contains the left border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property char_left_border_distance: UnitMM100 | None
Gets/Sets - This property contains the distance from the left border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property char_locale: Locale
Gets/Sets - This property contains the value of the locale.
- Return type:
Locale
- property char_no_hyphenation: bool | None
Gets/Sets - This optional property determines if the word can be hyphenated at the character.
optional
- Return type:
bool | None
- property char_no_line_break: bool | None
Gets/Sets - This optional property marks a range of characters to ignore a line break in this area.
A line break is applied behind the range of characters if the layout makes a break necessary within the range. That means that the text may go through the border.
optional
- Return type:
bool | None
- property char_posture: FontSlant
Gets/Sets - This property contains the value of the posture of the document.
- Returns:
Returns FontSlant
- Return type:
FontSlant
Hint
FontSlant
can be imported fromooo.dyn.awt.font_slant
- property char_relief: int | None
Gets/Sets - This optional property contains the relief style of the characters.
optional
- Return type:
int | None
- property char_right_border: BorderLine2StructComp | None
Gets/Sets - This property contains the right border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property char_right_border_distance: UnitMM100 | None
Gets/Sets - This property contains the distance from the right border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property char_rotation: Angle10 | None
Gets/Sets - This optional property determines the rotation of a character in tenths of a degree.
Depending on the implementation only certain values may be allowed.
optional
- Returns:
Returns Angle10,
1/10th
degrees, or None if not supported.- Return type:
Hint
Angle10
can be imported fromooodev.units
- property char_rotation_is_fit_to_line: bool | None
Gets/Sets - This optional property determines whether the text formatting tries to fit rotated text into the surrounded line height.
optional
- Return type:
bool | None
- property char_scale_width: int | None
Gets/Sets - This optional property determines the percentage value for scaling the width of characters.
The value refers to the original width which is denoted by
100
, and it has to be greater than0
.optional
- Return type:
int | None
- property char_shading_value: int | None
Gets/Sets - This optional property contains the text shading value.
optional
- Return type:
int | None
- property char_shadow_format: ShadowFormatStructComp | None
Gets/Sets the type, color, and width of the shadow.
When setting the value can be an instance of
ShadowFormatStructComp
orShadowFormat
.optional
- Returns:
Shadow Format or None if not supported.
- Return type:
Hint
ShadowFormat
can be imported fromooo.dyn.table.shadow_format
- property char_shadowed: bool | None
Gets/Sets - This optional property specifies if the characters are formatted and displayed with a shadow effect.
optional
- Return type:
bool | None
- property char_strikeout: FontStrikeoutEnum | None
Gets/Sets - This property determines the type of the strike out of the character.
optional
- Returns:
Returns FontStrikeoutEnum or None if not supported.
- Return type:
FontStrikeoutEnum | None
Hint
FontStrikeoutEnum
can be imported fromooo.dyn.awt.font_strikeout
- property char_style_name: str | None
Gets/Sets - This optional property specifies the name of the style of the font.
optional
- Return type:
str | None
- property char_style_names: Tuple[str, ...] | None
Gets/Sets - This optional property specifies the names of the all styles applied to the font.
It is not guaranteed that the order in the sequence reflects the order of the evaluation of the character style attributes.
Optional
- Return type:
Tuple[str, …] | None
- property char_top_border: BorderLine2StructComp | None
Gets/Sets - This property contains the top border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property char_top_border_distance: UnitMM100 | None
Gets/Sets - This property contains the distance from the top border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property char_transparence: int | None
Gets/Sets - This is the transparency of the character text.
The value
100
means entirely transparent, while0
means not transparent at all.optional
- Return type:
int | None
- property char_underline: FontUnderlineEnum
This property contains the value for the character underline.
- Return type:
FontUnderlineEnum
- property char_underline_color: Color
Gets/Sets the color of the underline for the characters.
- Returns:
Color
- Return type:
- property char_underline_has_color: bool
Gets/Sets if the property
char_underline_color
is used for an underline.- Return type:
bool
- property char_weight: float
Gets/Sets the value of the font weight.
Example
from com.sun.star.awt import FontWeight my_char_properties.char_weight = FontWeight.BOLD
- Return type:
float
- property char_word_mode: bool | None
Gets/Sets - If this property is
True
, the underline and strike-through properties are not applied to white spaces.optional
- Return type:
bool | None
- property component: com.sun.star.text.TextCursor
Sheet Cell Cursor Component
- Return type:
TextCursor
- property continuing_previous_sub_tree: bool | None
Gets that a child node of a parent node that is not counted is continuing the numbering of parent’s previous node’s sub tree.
optional
- Return type:
bool | None
- property drop_cap_char_style_name: str | None
Gets/Sets the character style name for drop caps.
optional
- Return type:
str | None
- property drop_cap_format: DropCapFormatStructComp | None
Gets/Sets whether the first characters of the paragraph are displayed in capital letters and how they are formatted.
optional
- Returns:
Drop cap format or None if not supported.
- Return type:
Hint
DropCapFormat
can be imported fromooo.dyn.style.drop_cap_format
- property drop_cap_whole_word: bool | None
Gets/Sets if the property DropCapFormat is applied to the whole first word.
optional
- Return type:
bool | None
- property event_observer: EventObserver
Gets/Sets The Event Observer for this instance.
- Return type:
- 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:
- property hyper_link_name: str | None
Gets/Sets - This optional property contains the name of the hyperlink.
optional
- Return type:
str | None
- property hyper_link_target: str | None
Gets/Sets - This optional property contains the name of the target for a hyperlink.
optional
- Return type:
str | None
- property hyper_link_url: str | None
Gets/Sets - This optional property contains the URL of a hyperlink.
optional
- Return type:
str | None
- property left_border: BorderLine2StructComp | None
Gets/Sets the left border of the object.
optional
- Return type:
BorderLine2StructComp | None
- property left_border_distance: UnitMM100 | None
Gets/Sets the distance from the left border to the object.
When setting the value, it can be either a float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property list_id: str | None
Gets/Sets the id of the list to which the paragraph belongs.
optional
- Return type:
str | None
- property list_label_string: str | None
Gets reading the generated numbering list label.
optional
- Return type:
str | None
- property numbering_is_number: bool | None
Gets/Sets.
Returns
False
if the paragraph is part of a numbering, but has no numbering label.A paragraph is part of a numbering, if a style for a numbering is set - see
numbering_style_name
. If the paragraph is not part of a numbering the property is void.optional
- Return type:
bool | None
- property numbering_level: int | None
Gets/Sets the numbering level of the paragraph.
optional
- Return type:
int | None
- property numbering_rules: IndexReplaceComp | None
Gets/Sets the numbering rules applied to this paragraph.
When setting the value, it can be either an instance of
XIndexReplace
orIndexReplaceComp
.optional
- Return type:
IndexReplaceComp | None
- property numbering_start_value: int | None
Gets/Sets the start value for numbering if a new numbering starts at this paragraph.
optional
- Return type:
int | None
- property numbering_style_name: str | None
Gets/Sets the name of the style for the numbering.
The name must be one of the names which are available via
XStyleFamiliesSupplier
.optional
- Return type:
str | None
- property office_doc: OfficeDocumentT
Office Document.
- Return type:
- property outline_level: int | None
Gets/Sets the outline level to which the paragraph belongs
Value
0
indicates that the paragraph belongs to the body text.Values
[1..10]
indicates that the paragraph belongs to the corresponding outline level.optional
- Return type:
int | None
- property owner: T
Owner of this component.
- Return type:
TypeVar
(T
, bound= ComponentT)
- property page_desc_name: str | None
If this property is set, it creates a page break before the paragraph it belongs to and assigns the value as the name of the new page style sheet to use.
optional
- Return type:
str | None
- property page_number_offset: int | None
Gets/Sets if a page break property is set at a paragraph, this property contains the new value for the page number.
optional
- Return type:
int | None
- property page_style_name: str | None
Gets the name of the current page style.
optional
- Return type:
str | None
- property para_adjust: ParagraphAdjust
Gets/Sets the adjustment of a paragraph.
- Returns:
Paragraph adjustment.
- Return type:
ParagraphAdjust
Hint
ParagraphAdjust
can be imported fromooo.dyn.style.paragraph_adjust
- property para_back_color: Color | None
Gets/Sets the paragraph background color.
optional
- Returns:
Color or None if not supported.
- Return type:
Color | None
- property para_back_graphic: XGraphic | None
Gets/Sets the graphic for the background of a paragraph.
optional
- Return type:
XGraphic | None
- property para_back_graphic_filter: str | None
Gets/Sets the name of the graphic filter for the background graphic of a paragraph.
optional
- Return type:
str | None
- property para_back_graphic_location: GraphicLocation | None
Gets/Sets the value for the position of a background graphic.
optional
- Returns:
Returns GraphicLocation or None if not supported.
- Return type:
GraphicLocation | None
Hint
GraphicLocation
can be imported fromooo.dyn.style.graphic_location
- property para_back_graphic_url: str | None
Gets/Sets the value of a link for the background graphic of a paragraph.
Note the new behavior since it this was deprecated: This property can only be set and only external URLs are supported (no more
vnd.sun.star.GraphicObject
scheme). When an URL is set, then it will load the graphic and set the ParaBackGraphic property.optional
- Return type:
str | None
- property para_back_transparent: bool | None
Gets/Sets if the paragraph background color is set to transparent.
This value is
True
if the paragraph background color is set to transparent.optional
- Return type:
bool | None
- property para_bottom_margin: UnitMM100
Gets/Sets the bottom margin of the paragraph in
100th mm
.The distance between two paragraphs is specified by:
The greater one is chosen.
This property accepts
int
andUnitT
types when setting.- Return type:
- property para_context_margin: bool | None
Gets/Sets if contextual spacing is used.
If
True
, the top and bottom margins of the paragraph should not be applied when the previous and next paragraphs have the same style.optional
- Return type:
bool | None
- property para_expand_single_word: bool | None
Gets/Sets if single words are stretched.
It is only valid if
para_adjust
andpara_last_line_adjust
are also valid.optional
- Return type:
bool | None
- property para_first_line_indent: int | None
Gets/Sets the indent for the first line.
optional
- Return type:
int | None
- property para_hyphenation_max_hyphens: int | None
Gets/Sets the maximum number of consecutive hyphens.
optional
- Return type:
int | None
- property para_hyphenation_max_leading_chars: int | None
Gets/Sets the minimum number of characters to remain before the hyphen character (when hyphenation is applied).
Note
Confusingly it is named Max but specifies a minimum.
optional
- Return type:
int | None
- property para_hyphenation_max_trailing_chars: int | None
Gets/Sets the minimum number of characters to remain after the hyphen character (when hyphenation is applied).
optional
Note
Confusingly it is named Max but specifies a minimum.
- Return type:
int | None
- property para_hyphenation_min_word_length: int | None
Gets/Sets the minimum word length in characters, when hyphenation is applied.
since
LibreOffice 7.4
optional
- Return type:
int | None
- property para_hyphenation_no_caps: bool | None
Specifies whether words written in CAPS will be hyphenated.
Setting to true will disable hyphenation of words written in CAPS for this paragraph.
optional
- Return type:
bool | None
- property para_hyphenation_no_last_word: bool | None
Specifies whether last word of paragraph will be hyphenated.
Setting to true will disable hyphenation of last word for this paragraph.
since
LibreOffice 7.4
optional
- Return type:
bool | None
- property para_hyphenation_zone: int | None
Gets/Sets the hyphenation zone, i.e. allowed extra white space in the line before applying hyphenation.
since
LibreOffice 7.4
optional
- Return type:
int | None
- property para_interop_grab_bag: Tuple[PropertyValue, ...] | None
Gets/Sets grab bag of paragraph properties, used as a string-any map for interim interop purposes.
This property is intentionally not handled by the ODF filter. Any member that should be handled there should be first moved out from this grab bag to a separate property.
optional:
- Return type:
Tuple[PropertyValue, …] | None
- property para_is_auto_first_line_indent: bool | None
Gets/Sets if the first line should be indented automatically.
optional
- Return type:
bool | None
- property para_is_connect_border: bool | None
Gets/Sets if borders set at a paragraph are merged with the next paragraph.
Borders are only merged if they are identical.
optional
- Return type:
bool | None
- property para_is_hyphenation: bool
Gets/Sets if automatic hyphenation is applied.
- Return type:
bool
- property para_is_numbering_restart: bool | None
Gets/Sets if the numbering rules restart, counting at the current paragraph.
optional
- Return type:
bool | None
- property para_keep_together: bool | None
Gets/Sets if page or column breaks between this and the following paragraph are prevented.
Setting this property to
True
prevents page or column breaks between this and the following paragraph.This feature is useful for preventing title paragraphs to be the last line on a page or column.
optional
- Return type:
bool | None
- property para_last_line_adjust: int
Gets/Sets the adjustment of the last line.
It is only valid if
para_adjust
is set toblock
.- Return type:
int
- property para_left_margin: UnitMM100
Gets/Sets the left margin of the paragraph in 1/100th mm` units.
This property accepts
int
andUnitT
types when setting.- Return type:
- property para_line_number_count: bool | None
Gets/Sets if the paragraph is included in the line numbering.
optional
- Return type:
bool | None
- property para_line_number_start_value: int | None
Gets/Sets the start value for the line numbering.
optional
- Return type:
int | None
- property para_line_spacing: LineSpacingStructComp | None
Gets/Sets the type of the line spacing of a paragraph.
Setting value can be done with a
LineSpacing
orLineSpacingStructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
LineSpacingStructComp | None
Hint
LineSpacing
can be imported fromooo.dyn.style.line_spacing
- property para_orphans: int | None
Gets/Sets the minimum number of lines of the paragraph that have to be at bottom of a page if the paragraph is spread over more than one page.
optional
- Return type:
int | None
- property para_register_mode_active: bool | None
Gets/Sets if the register mode is applied to a paragraph.
Note
Register mode is only used if the register mode property of the page style is switched on.
optional
- Return type:
bool | None
- property para_right_margin: UnitMM100
Gets/Sets the right margin of the paragraph in
100th mm
units.This property accepts
float
andUnitT
types when setting.- Return type:
- property para_shadow_format: ShadowFormat | None
Gets/Sets the type, color, and size of the shadow.
optional
- Return type:
ShadowFormat | None
- property para_split: bool | None
Gets/Sets - Setting this property to
False
prevents the paragraph from getting split into two pages or columns.optional
- Return type:
bool | None
- property para_style_name: str | None
Gets/Sets the name of the current paragraph style.
optional
- Return type:
str | None
- property para_tab_stops: Tuple[TabStop, ...] | None
Gets/Sets the positions and kinds of the tab stops within this paragraph.
optional:
- Return type:
Tuple[TabStop, …] | None
- property para_top_margin: UnitMM100
determines the top margin of the paragraph in
100th mm
units.The distance between two paragraphs is specified by:
The greater one is chosen.
This property accepts
float
andUnitT
types when setting.- Return type:
- property para_user_defined_attributes: NameContainerComp | None
Gets/Sets - this property stores xml attributes.
They will be saved to and restored from automatic styles inside xml files.
Can be set with
XNameContainer
orNameContainerComp
.optional
- Return type:
NameContainerComp | None
- property para_vert_alignment: ParagraphVertAlignEnum | None
Gets/Set the vertical alignment of a paragraph.
When setting the value, it can be either an integer or an instance of
ParagraphVertAlignEnum
.optional
- Return type:
ParagraphVertAlignEnum | None
- property para_widows: int | None
Gets/Sets the minimum number of lines of the paragraph that have to be at top of a page if the paragraph is spread over more than one page.
optional
- Return type:
int | None
- property right_border: BorderLine2StructComp | None
Gets/Sets the right border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property right_border_distance: UnitMM100 | None
Gets/Sets the distance from the right border to the object.
When setting the value, it can be either an float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property ruby_adjust: int | None
Gets/Sets - This optional property determines the adjustment of the ruby .
optional
- Return type:
int | None
- property ruby_char_style_name: str | None
Gets/Sets - This optional property contains the name of the character style that is applied to RubyText.
optional
- Return type:
str | None
- property ruby_is_above: bool | None
Gets/Sets - This optional property determines whether the ruby text is printed above/left or below/right of the text.
This property is replaced by RubyPosition.
optional
- Return type:
bool | None
- property ruby_position: RubyPositionEnum | None
Gets/Sets - This optional property determines the position of the ruby .
optional
- Returns:
Returns RubyPositionEnum or None if not supported.
- Return type:
RubyPositionEnum | None
Hint
RubyPositionEnum
can be imported fromooo.dyn.text.ruby_position
- property ruby_text: str | None
Gets/Sets - This optional property contains the text that is set as ruby.
optional
- Return type:
str | None
- property style_direct_char: CharacterStyler
Direct Character Styler.
- Returns:
Character Styler
- Return type:
- property text_user_defined_attributes: NameContainerComp | None
Gets/Sets - This property stores XML attributes.
They will be saved to and restored from automatic styles inside XML files.
When setting the value, it can be a
NameContainerComp
or aXNameContainer
instance.optional
- Return type:
NameContainerComp | None
- property top_border: BorderLine2StructComp | None
Gets/Sets the top border of the object.
Setting value can be done with a
BorderLine2
orBorderLine2StructComp
object.optional
- Returns:
Returns BorderLine2 or None if not supported.
- Return type:
BorderLine2StructComp | None
Hint
BorderLine2
can be imported fromooo.dyn.table.border_line2
- property top_border_distance: UnitMM100 | None
Gets/Sets the distance from the top border to the object.
When setting the value, it can be either an float or an instance of
UnitT
.optional
- Return type:
UnitMM100 | None
- property unvisited_char_style_name: str | None
Gets/Sets - This optional property contains the character style name for unvisited hyperlinks.
optional
- Return type:
str | None
- property visited_char_style_name: str | None
Gets/Sets - This optional property contains the character style name for visited hyperlinks.
optional
- Return type:
str | None