Class WriteTextViewCursor
- class ooodev.write.WriteTextViewCursor(owner, component, lo_inst=None)[source]
Bases:
LoInstPropsPartial
,WriteDocPropPartial
,TextCursorPartial
[T
],Generic
[T
],TextViewCursorComp
,CharacterPropertiesPartial
,ParagraphPropertiesPartial
,LineCursorPartial
,PropertyChangeImplement
,VetoableChangeImplement
,PropPartial
,QiPartial
,TheDictionaryPartial
,StylePartial
,EventsPartial
Represents a writer text view cursor.
- __init__(owner, component, lo_inst=None)[source]
Constructor
- Parameters:
owner (T) – Owner of this component.
component (XTextViewCursor) – A UNO object that supports
com.sun.star.text.TextViewCursor
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
- export_page_jpg(fnm='', resolution=96)[source]
Exports doc pages as jpg images.
- Parameters:
fnm (PathOrStr, optional) – Image file name.
resolution (int, optional) – Resolution in dpi. Defaults to 96.
- Events:
- Return type:
None
Note
On exporting event is Class CancelEventArgsExport. On exported event is Class EventArgsExport. Args
event_data
is aExportJpgT
dictionary.If
fnm
is not specified, the image file name is created based on the document name and page number and written to the same folder as the document.Example
from ooodev.events.args.cancel_event_args_export import CancelEventArgsExport from ooodev.events.args.event_args_export import EventArgsExport from ooodev.write import Write, WriteDoc from ooodev.write import WriteNamedEvent from ooodev.write.filter.export_jpg import ExportJpgT # ... code omitted ... def export_pages_jpg(doc_file: str): doc = WriteDoc(Write.open_doc(fnm=doc_file)) def on_exporting(source: Any, args: CancelEventArgsExport[ExportJpgT]) -> None: args.event_data["quality"] = 80 # Default is 75 def on_exported(source: Any, args: EventArgsExport[ExportJpgT]) -> None: print(args.get("url")) try: view = doc.get_view_cursor() doc_path = Path(doc.get_doc_path()) view.jump_to_last_page() # optionally subscribe to events to make fine tune export view.subscribe_event(WriteNamedEvent.EXPORTED_PAGE_JPG, on_exported) view.subscribe_event(WriteNamedEvent.EXPORTING_PAGE_JPG, on_exporting) for i in range(view.get_page(), 0, -1): img_path = Path(tmp_path_fn, f"{doc_path.stem}_{i}.jpg") # export 300 DPI view.export_page_jpg(fnm=img_path, resolution=300) view.jump_to_previous_page() view.jump_to_first_page() finally: doc.close_doc()
See also
- export_page_png(fnm='', resolution=96)[source]
Exports doc pages as png images.
- Parameters:
fnm (PathOrStr, optional) – Image file name.
resolution (int, optional) – Resolution in dpi. Defaults to 96.
- Events:
- Return type:
None
Note
On exporting event is Class CancelEventArgsExport. On exported event is Class EventArgsExport. Args
event_data
is aExportPngT
dictionary.If
fnm
is not specified, the image file name is created based on the document name and page number and written to the same folder as the document.Example
from ooodev.events.args.cancel_event_args_export import CancelEventArgsExport from ooodev.events.args.event_args_export import EventArgsExport from ooodev.write import Write, WriteDoc from ooodev.write import WriteNamedEvent from ooodev.write.filter.export_png import ExportPngT # ... code omitted ... def export_pages_png(doc_file: str): doc = WriteDoc(Write.open_doc(fnm=doc_file)) def on_exporting(source: Any, args: CancelEventArgsExport[ExportPngT]) -> None: args.event_data["compression"] = 5 # default is 6 def on_exported(source: Any, args: EventArgsExport[ExportPngT]) -> None: print(args.get("url")) try: view = doc.get_view_cursor() doc_path = Path(doc.get_doc_path()) view.jump_to_last_page() # optionally subscribe to events to make fine tune export view.subscribe_event(WriteNamedEvent.EXPORTED_PAGE_PNG, on_exported) view.subscribe_event(WriteNamedEvent.EXPORTING_PAGE_PNG, on_exporting) for i in range(view.get_page(), 0, -1): img_path = Path(tmp_path_fn, f"{doc_path.stem}_{i}.png") # export 300 DPI view.export_page_png(fnm=img_path, resolution=300) view.jump_to_previous_page() view.jump_to_first_page() finally: doc.close_doc()
See also
- get_all_text()
Gets the text part of the document
- Returns:
text
- Return type:
str
- get_coord_str()[source]
Gets coordinates for cursor in format such as
"10, 10"
- Returns:
coordinates as string
- Return type:
str
- get_current_page()
Gets current page number.
- Returns:
current page number
- Return type:
int
- get_current_page_num()[source]
Gets current page number.
- Returns:
current page number
- Return type:
int
- get_end()
Returns a text range which contains only the end of this text range.
- Return type:
- get_page()
Returns the current page number.
- Return type:
int
- 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_position()
Gets the cursor’s coordinates relative to the top left position of the first page of the document in
1/100 mm
.- Returns:
The cursor’s coordinates as
com.sun.star.awt.Point
. in1/100 mm
.- Return type:
Note
The
X
coordinate is the horizontal position, theY
coordinate is the vertical position.Warning
The
X
is relative to the document window and not the document page. This means when the document window size changes theX
coordinate will change even if the cursor has not moved. This is also the case if the document zoom changes.When the document page is zoomed all the way to fill the document window the
X
coordinate is0
when at the left hand page margin (beginning of a line).The
Y
coordinate is relative to the top of the document window and not the top of the document page. TheY
coordinate seems not to be affected by Document Zoom or scroll position.
- 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_text_view_cursor()[source]
Gets the text view cursor.
- Returns:
text view cursor
- Return type:
XTextViewCursor
- 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_line(expand=False)
Moves the cursor to the end of the current line.
- Parameters:
expand (bool, optional) – Determines whether the text range of the cursor is expanded (
True
) or the cursor will be just at the new position after the move (False
). Defaults toFalse
.- Return type:
None
- 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_line(expand=False)
Moves the cursor to the start of the current line.
- Parameters:
expand (bool, optional) – Determines whether the text range of the cursor is expanded (
True
) or the cursor will be just at the new position after the move (False
). Defaults toFalse
.- Return type:
None
- 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_at_end_of_line()
Determines if the cursor is positioned at the end of a line.
- Returns:
True
if the cursor is positioned at the end of a line,False
otherwise.- Return type:
bool
- is_at_start_of_line()
Determines if the cursor is positioned at the start of a line.
- Returns:
True
if the cursor is positioned at the start of a line,False
otherwise.- Return type:
bool
- is_collapsed()
Returns
True
if the cursor is collapsed.- Return type:
bool
- is_visible()
Returns True if the cursor is visible.
- Return type:
bool
- jump_to_end_of_page()
Jumps to the end of the current page.
- Returns:
True
if the jump was successful,False
otherwise.- Return type:
bool
- jump_to_first_page()
Jumps to the first page.
- Returns:
True
if the jump was successful,False
otherwise.- Return type:
bool
- jump_to_last_page()
Jumps to the last page.
- Return type:
None
- jump_to_next_page()
Jumps to the next page.
- Returns:
True
if the jump was successful,False
otherwise.- Return type:
bool
- jump_to_page_(number)
Jumps to the page with the given number.
- Parameters:
number (int) – Page number to jump to.
- Returns:
True
if the jump was successful,False
otherwise.- Return type:
bool
- jump_to_previous_page()
Jumps to the previous page.
- Returns:
True
if the jump was successful,False
otherwise.- Return type:
bool
- jump_to_start_of_page()
Jumps to the start of the current page.
- Returns:
True
if the jump was successful,False
otherwise.- 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
- screen_down()
Scrolls the view forward by one visible page.
- Return type:
None
- screen_up()
Scrolls the view backward by one visible page.
- 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) –
- set_visible(visible=True)
Sets the visibility of the cursor.
- Parameters:
visible (bool, optional) –
True
to set the view cursor visible, False to hide it. Defaults toTrue
.- Return type:
None
- 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
- 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.TextViewCursor
Sheet Cell Cursor Component
- Return type:
TextViewCursor
- 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