Class WriteTableCell
- class ooodev.write.table.write_table_cell.WriteTableCell(owner, component, cell_obj)[source]
Bases:
WriteDocPropPartial,WriteTablePropPartial,EventsPartial,CellPropertiesComp,CellPartial,TextPartial,LoInstPropsPartial,PropPartial,StylePartial,QiPartialRepresents writer table rows.
- Parameters:
owner (ComponentT) –
component (XCell) –
cell_obj (CellObj) –
- __init__(owner, component, cell_obj)[source]
Constructor
- Parameters:
component (XCell) – UNO object that supports
com.sun.star.table.XCellinterface.owner (Any) –
cell_obj (CellObj) –
- Return type:
None
- add_event_observers(*args)
Adds observers that gets their
triggermethod called when this classtriggermethod 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_datawill contain acom.sun.star.beans.PropertyChangeEventstruct.- 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_datawill contain a UNOcom.sun.star.lang.EventObjectstruct.- 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_datawill contain acom.sun.star.beans.PropertyChangeEventstruct.- 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_datawill contain a UNOcom.sun.star.lang.EventObjectstruct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- apply_styles(*styles, **kwargs)
Applies style to component.
- Parameters:
obj. (styles expandable list of styles object such as Font to apply to) –
kwargs (Any, optional) – Expandable list of key value pairs.
styles (StyleT) –
- Return type:
None
- create_text_cursor()[source]
Creates a text cursor to travel in the given range context.
Cursor can be used to insert text, paragraphs, hyperlinks, and other text content.
- Returns:
Text cursor
- Return type:
- create_text_cursor_by_range(text_position)[source]
The initial position is set to
text_position.Cursor can be used to insert text, paragraphs, hyperlinks, and other text content.
- Parameters:
text_position (XTextRange) – The initial position of the new text cursor.
- Returns:
The new text cursor.
- Return type:
- get_cell_down()[source]
Get the cell below.
- Raises:
IndexError – If cell above is out of range
- Return type:
- get_cell_left()[source]
Get the cell to the left.
- Raises:
IndexError – If cell above is out of range
- Return type:
- get_cell_right()[source]
Get the cell to the right.
- Raises:
IndexError – If cell above is out of range
- Return type:
- get_cell_up()[source]
Get the cell above.
- Raises:
IndexError – If cell above is out of range
- Return type:
- get_end()
Returns a text range which contains only the end of this text range.
- Return type:
- get_error()
returns the error value of the cell.
If the cell does not contain a formula, the error is always zero.
- Return type:
int
- get_formula()
returns the formula string of a cell.
Even if the cell does not contain a formula, an assignment of this attribute’s value to another cell’s formula attribute would create the same cell content. This is because this attribute contains the original text value of a string cell. The value of a value cell will be formatted using the number format’s default format or the formula string, including “=”, of a formula cell.
- Return type:
str
- get_property(name, default=<ooodev.utils.gen_util._null_obj 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_type()
Gets the type of the cell.
- Returns:
The type of the cell.
- Return type:
CellContentType
Hint
CellContentTypecan be imported fromooo.dyn.table.cell_content_type.
- get_value()
Gets the floating point value of the cell.
For a value cell the value is returned, for a string cell zero is returned and for a formula cell the result value of a formula is returned.
- Return type:
float
- insert_control_character(rng, control_character, absorb)
Inserts a control character (like a paragraph break or a hard space) into the text.
- Parameters:
rng (XTextRange) – The position of the new control character.
control_character (ControlCharacterEnum) – The control character to be inserted.
absorb (bool) – If TRUE the text range will contain the new inserted control character, otherwise the range (and it’s text) will remain unchanged.
- Raises:
IllegalArgumentException –
com.sun.star.lang.IllegalArgumentException- Return type:
None
- insert_string(rng, text, absorb)
Inserts a string of characters into the text.
The string may contain the following white spaces:
If the parameter bAbsorb() was TRUE the text range will contain the new inserted string, otherwise the range (and it’s text) will remain unchanged.
- Return type:
None- Parameters:
rng (XTextRange) –
text (str) –
absorb (bool) –
- insert_text_content(rng, content, absorb)
Inserts a content, such as a text table, text frame or text field.
- Parameters:
rng (XTextRange) – The position at which the content is inserted.
content (XTextContent) – The content to be inserted.
absorb (bool) – Specifies whether the text spanned by xRange will be replaced. If
Truethen the content of range will be replaced by content, otherwise content will be inserted at the end of xRange.
- Return type:
None
- qi(atype, raise_err=False)
Generic method that get an interface instance from an object.
- Parameters:
atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface
raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False
- Raises:
MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None
- Returns:
instance of interface if supported; Otherwise, None
- Return type:
T | None
Note
When
raise_err=Truereturn value will never beNone.
- remove_event_observer(observer)
Removes an observer
- Parameters:
observer (EventObserver) – One or more observers to add.
- Returns:
Trueif 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
- remove_text_content(content)
Removes a text content.
- Parameters:
content (XTextContent) – the content that is to be removed.
- Return type:
None
- set_formula(formula)
Sets a formula into the cell.
When assigned, the string will be interpreted and a value, text or formula cell is created, depending on the text and the number format.
- Return type:
None- Parameters:
formula (str) –
- 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_value(value)
Sets a floating point value into the cell.
After a call to this method the type of the cell is C``ellContentType.VALUE``.
- Return type:
None- Parameters:
value (float) –
- 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 back_color: Color
Gets/Sets the background color.
- Returns:
Returns Color.
- Return type:
Color
- property back_graphic: com.sun.star.graphic.XGraphic
Gets/Sets the graphic object that is displayed as background graphic.
- Return type:
XGraphic
- property back_graphic_filter: str
Gets/Sets the name of the graphic filter of the background graphic.
- Return type:
str
- property back_graphic_location: GraphicLocation
Gets/Sets the position of the background graphic.
- Returns:
Returns GraphicLocation.
- Return type:
GraphicLocation
Hint
GraphicLocationcan be imported fromooo.dyn.style.graphic_location
- property back_graphic_url: str
Gets/Sets the URL to the background graphic.
- Returns:
Returns URL to the background graphic.
- Return type:
str
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 BackGraphic property.
- property back_transparent: bool
Gets/Sets whether the background is transparent.
- Return type:
bool
- property bottom_border: BorderLine2StructComp
Gets/Sets a description of the bottom border line of each cell.
Setting value can be done with a
BorderLineorBorderLine2StructCompobject.- Returns:
Returns Border Line.
- Return type:
Hint
BorderLinecan be imported fromooo.dyn.table.border_line
- property bottom_border_distance: UnitMM100
Gets/Sets the distance of the bottom border.
When setting the value, it can be an integer (in
1/100mmunits) or aUnitTobject.- Returns:
Returns the distance of the bottom border.
- Return type:
- property cell_name: str
Gets the cell name.
- Return type:
str
- property cell_obj: CellObj
Get the cell object.
Note
The
CellObjreturned from this property is a sub-range of the parent range or Table. This means theCellObjcontains relative values to the parent range or table. For this reason the cell name and index do not match up with the parent range.- Return type:
- property component: com.sun.star.text.CellProperties
CellProperties Component
- Return type:
CellProperties
- property event_observer: EventObserver
Gets/Sets The Event Observer for this instance.
- Return type:
- property float_value: float
Get the cell float value.
When the cell is a formula and the value is 0, then by default the
valueproperty will return a string. This property will always return a float. If the value of the cell is not a number, or cannot be converted to a number then0.0is returned.- Return type:
float
- property is_protected: bool
Gets/Sets whether the cell is write protected or not.
- Return type:
bool
- property left_border: BorderLine2StructComp
Gets/Sets a description of the left border line of each cell.
Setting value can be done with a
BorderLineorBorderLine2StructCompobject.- Returns:
Returns Border Line.
- Return type:
Hint
BorderLinecan be imported fromooo.dyn.table.border_line
- property left_border_distance: UnitMM100
Gets/Sets the distance of the left border.
When setting the value, it can be an integer (in
1/100mmunits) or aUnitTobject.- Returns:
Returns the distance of the left border.
- Return type:
- property number_format: int
Gets/Sets the index of the number format that is used in the cells.
The proper value can be determined by using the
com.sun.star.util.NumberFormatterinterface of the document.- Return type:
int
- property office_doc: OfficeDocumentT
Office Document.
- Return type:
- property owner: Any
Owner of this component.
- Return type:
Any
- property parent_text: TextComp | None
Gets the parent text of this table cell.
This might be a header text, body text, parent cell, etc.
optional
- Return type:
TextComp | None
- property right_border: BorderLine2StructComp
Gets/Sets a description of the right border line of each cell.
Setting value can be done with a
BorderLineorBorderLine2StructCompobject.- Returns:
Returns Border Line.
- Return type:
Hint
BorderLinecan be imported fromooo.dyn.table.border_line
- property right_border_distance: UnitMM100
Gets/Sets the distance of the right border.
When setting the value, it can be an integer (in
1/100mmunits) or aUnitTobject.- Returns:
Returns the distance of the right border.
- Return type:
- property style_direct: CellStyler
Direct Cell Styler.
- Returns:
Character Styler
- Return type:
- property text_section: TextSectionComp | None
Gets the text section the text table is contained in if there is any.
- Return type:
TextSectionComp | None
- property top_border: BorderLine2StructComp
Gets/Sets a description of the top border line of each cell.
Setting value can be done with a
BorderLineorBorderLine2StructCompobject.- Returns:
Returns Border Line.
- Return type:
Hint
BorderLinecan be imported fromooo.dyn.table.border_line
- property top_border_distance: UnitMM100
Gets/Sets the distance of the top border.
When setting the value, it can be an integer (in
1/100mmunits) or aUnitTobject.- Returns:
Returns the distance of the bottom border.
- Return type:
- property value: Any
Get/Sets the cell value.
If the cell is a formula and the value is 0, then a string will be returned. Use the
float_valueproperty to always get a float value.- Return type:
Any
- property vert_orient: VertOrientationEnum
Gets/Sets the vertical orientation of the text inside of the table cells in this row.
When setting the value, it can be an integer or an instance of
VertOrientationEnum.- Returns:
Returns Vertical Orientation.
- Return type:
VertOrientationEnum
Hint
VertOrientationEnumcan be imported fromooo.dyn.text.vert_orientation
- property write_table: WriteTable[Any]
Write Document.
- Return type:
WriteTable[Any]