Class WriteTableRow
- class ooodev.write.table.write_table_row.WriteTableRow(owner, component, idx=-1)[source]
Bases:
WriteDocPropPartial
,WriteTablePropPartial
,EventsPartial
,TextTableRowComp
,LoInstPropsPartial
,PropertyChangeImplement
,VetoableChangeImplement
,PropPartial
,StylePartial
Represents writer table row.
- Parameters:
owner (Any) –
component (TextTableRow) –
idx (int) –
- __getitem__(key)[source]
Returns the Write Table Cell. The cell must exist in the current row.
- Parameters:
key (Any) – Key. can be a integer such as
2
for column index (-1
get last cell in row,-2
second last) or a string such as “A1” or aCellObj
.- Returns:
Table Cell Object.
- Return type:
- Raises:
IndexError – If the key is out of range.
Note
If key is an integer then it is assumed to be a column index. If key is a string then it is assumed to be a cell name.
Cell names and
CellObj
are relative to the current row. If the current row is the first row of the table then the cell names andCellObj
are the same as the parent table. If the row index is 3 thenrow[`A1`]
is the same astable[`A4`]
.No mater the row index the first cell of the row is always
row[0]
orrow['A1']
.Example
>>> table = doc.tables[0] >>> row = table.rows[3] >>> cell = row["A1"] # or row[0] >>> print(cell, cell.value) WriteTableCell(cell_name=A4) Goldfinger
- __init__(owner, component, idx=-1)[source]
Constructor
- Parameters:
owner (Any) – Owner of this component.
component (TextTableRow) – UNO object that supports
om.sun.star.text.TextTableRow
service.idx (int, optional) – Index of this row. Defaults to
-1
.
- Return type:
None
- __iter__()[source]
Iterates through the cells of the row.
- Return type:
Generator
[WriteTableCell
,None
,None
]
- 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_property_change_listener(name, listener)
Adds a listener for property changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be added.
- Return type:
None
- add_vetoable_change_listener(name, listener)
Adds a listener for vetoable changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be added.
- 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
- 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_property_set_info()
Returns the property set info.
- Returns:
The property set info.
- Return type:
XPropertySetInfo
- get_property_value(name)
Returns the value of a property.
- Parameters:
name (str) – The name of the property.
- Returns:
The value of the property.
- Return type:
Any
- get_row_data(as_floats=False)[source]
Gets the data of the row.
- Parameters:
as_floats (bool, optional) – If
True
then get all values as floats. If the cell is not a number then it is converted to0.0
. Defaults toFalse
.- Returns:
Row data. If
as_floats
isTrue
then all values are floats.- Return type:
Tuple[float | str | None, …]
- 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
- remove_property_change_listener(name, listener)
Removes a listener for property changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be removed.
- Return type:
None
- remove_vetoable_change_listener(name, listener)
Removes a listener for vetoable changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be removed.
- 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_property_value(name, value)
Sets the value of a property.
- Parameters:
name (str) – The name of the property.
value (Any) – The value of the property.
- 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 back_graphic: XGraphic | None
Gets/Sets the graphic of the background.
optional
- Return type:
XGraphic | None
- property back_graphic_filter: str
Gets/Sets - the name of the file filter of a background graphic.
- Return type:
str
- property back_graphic_location: GraphicLocation
Gets/Sets the position of the background graphic.
Hint
GraphicLocation
can be imported fromooo.dyn.style.graphic_location
- Return type:
GraphicLocation
- property back_graphic_url: str
Gets/Sets the URL of a background graphic.
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.
- Return type:
str
- property back_transparent: bool
If
True
, the background color value inback_color
is not visible.- Return type:
bool
- property component: com.sun.star.text.TextTableRow
TextTableRow Component
- Return type:
TextTableRow
- property event_observer: EventObserver
Gets/Sets The Event Observer for this instance.
- Return type:
- property has_text_changes_only: bool | None
Gets/Sets - If
True
, the table row wasn’t deleted or inserted with its tracked cell content.Since LibreOffice 7.2
optional
- Return type:
bool | None
- property height: UnitMM100
Gets/Sets the height of the table row.
When setting the height, the
is_auto_height
property must beFalse
for the height to have an effect. Setting the height can be done with aUnitT
or an integer in1/100th mm
units.- Returns:
Height
- Return type:
Note
is_auto_height
must beFalse
for height to have an effect.Hint
UnitMM100
can be imported fromooodev.units
- property index: int
Index of this row.
- Return type:
int
- property is_auto_height: bool
Gets/Sets - If the value of this property is
True
, the height of the table row depends on the content of the table cells.- Return type:
bool
- property is_split_allowed: bool | None
If
True
, the row is allowed to be split at page or column breaks.optional
- Return type:
bool | None
- property office_doc: OfficeDocumentT
Office Document.
- Return type:
- property owner: Any
Owner of this component.
- Return type:
Any
- property row_interop_grab_bag: Tuple[PropertyValue, ...] | None
Gets/Sets - Grab bag of row properties, used as a string-any map for 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 table_column_separators: Tuple[com.sun.star.text.TableColumnSeparator, ...]
Gets/Sets - contains the description of the columns in the table row.
- Return type:
Tuple
[TableColumnSeparator
,...
]
- property write_table: WriteTable[Any]
Write Document.
- Return type:
WriteTable
[Any
]