Class CalcCell

class ooodev.calc.CalcCell(owner, cell, lo_inst=None)[source]

Bases: LoInstPropsPartial, SheetCellComp, EventsPartial, CellProperties2PartialProps, QiPartial, PropPartial, StylePartial, ServicePartial, CalcCellPropPartial, CalcSheetPropPartial, CalcDocPropPartial, FontOnlyPartial, FontEffectsPartial, FontPartial, TextAlignPartial, TextOrientationPartial, PropertiesPartial, FillColorPartial, CalcBordersPartial, CellProtectionPartial, NumbersNumbersPartial, StylePropertyPartial

Parameters:
  • owner (CalcSheet) –

  • cell (str | mCellObj.CellObj) –

  • lo_inst (LoInst | None) –

__eq__(other)[source]

Compares two instances of CalcCell.

Return type:

bool

Parameters:

other (Any) –

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

Constructor.

Parameters:
  • lo_inst (LoInst, optional) – Lo instance.

  • owner (CalcSheet) –

  • cell (str | mCellObj.CellObj) –

Return type:

None

__ne__(other)[source]

Compares two instances of CalcCell.

Return type:

bool

Parameters:

other (Any) –

add_annotation(msg, is_visible=True)[source]

Adds an annotation to a cell and makes the annotation visible.

Parameters:
  • sheet (XSpreadsheet) – Spreadsheet

  • cell_name (str) – Name of cell to add annotation such as ‘A1’

  • msg (str) – Annotation Text

  • set_visible (bool) – Determines if the annotation is set visible

Raises:

MissingInterfaceError – If interface is missing

Returns:

Cell annotation that was added

Return type:

XSheetAnnotation

add_event_modified(cb)

Adds a listener for an event.

Event is invoked when something changes in the object.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_modify_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger 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 a com.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 UNO com.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 a com.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 UNO com.sun.star.lang.EventObject struct.

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_cursor()[source]

Creates a cell cursor to travel in the given range context.

Returns:

Cell cursor

Return type:

CalcCellCursor

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:

CalcCellTextCursor

New in version 0.28.4.

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:

CalcCellTextCursor

New in version 0.28.4.

get_annotation()[source]

Gets the annotation of a cell.

Returns:

Cell annotation

Return type:

XSheetAnnotation

get_annotation_str()[source]

Gets text of an annotation for a cell.

Returns:

Cell annotation text

Return type:

str

get_cell_down()[source]

Gets the cell below this cell.

Returns:

Cell below this cell.

Return type:

CalcCell

get_cell_left()[source]

Gets the cell to the left of this cell.

Raises:

CellError – If cell is in the first column of the sheet.

Returns:

Cell to the left of this cell.

Return type:

CalcCell

get_cell_position()[source]

Gets a cell name as a Point.

  • Point.X is column zero-based index.

  • Point.Y is row zero-based index.

Returns:

cell name as Point with X as col and Y as row

Return type:

Point

get_cell_right()[source]

Gets the cell to the right of this cell.

Raises:

CellError – If cell is in the last column of the sheet.

Returns:

Cell to the right of this cell.

Return type:

CalcCell

get_cell_str()[source]

Gets the cell as a string in format of A1

Returns:

Cell as str

Return type:

str

get_cell_up()[source]

Gets the cell above this cell.

Returns:

Cell above this cell.

Return type:

CalcCell

get_custom_properties()[source]

Gets custom properties.

Returns:

custom properties.

Return type:

DotDict

Hint

DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from ooodev.utils.helper.dot_dict.DotDict.

get_custom_property(name, default=<object object>)[source]

Gets a custom property.

Parameters:
  • name (str) – The name of the property.

  • default (Any, optional) – The default value to return if the property does not exist.

Raises:

AttributeError – If the property is not found.

Returns:

The value of the property.

Return type:

Any

get_end()

Returns a text range which contains only the end of this text range.

Return type:

TextRangeComp

get_num()[source]

Get cell value a float

Returns:

Cell value as float. If cell value cannot be converted then 0.0 is returned.

Return type:

float

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_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

get_start()

Returns a text range which contains only the start of this text range.

Return type:

TextRangeComp

get_string()[source]

Gets the value of a cell as a string.

Returns:

Cell value as string.

Return type:

str

get_text()

Gets the text of the range.

Returns:

The text of the range.

Return type:

XText

get_type_enum()[source]

Gets enum representing the Type

Returns:

Enum of cell type

Return type:

CellTypeEnum

get_type_string()[source]

Gets String representing the Type

Returns:

String of cell type

Return type:

str

get_val()[source]

Gets cell value

Returns:

Cell value cell has a value; Otherwise, None

Return type:

Any | None

goal_seek(gs, formula_cell_name, result)[source]

Calculates a value which gives a specified result in a formula.

Parameters:
  • gs (XGoalSeek) – Goal seeking value for cell

  • formula_cell_name (str | CellObj) – formula cell name

  • result (int, float) – float or int, result of the goal seek

Raises:

GoalDivergenceError – If goal divergence is greater than 0.1

Returns:

result of the goal seek

Return type:

float

goto()[source]

Go to this cell in the spreadsheet.

Return type:

None

Attention

dispatch_cmd() method is called along with any of its events.

Dispatch command is GoToCell.

New in version 0.20.2.

has_custom_properties()[source]

Gets if a custom properties exists.

Returns:

True if the properties exists, otherwise False.

Return type:

bool

has_custom_property(name)[source]

Gets if a custom property exists.

Parameters:

name (str) – The name of the property to check.

Returns:

True if the property exists, otherwise False.

Return type:

bool

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:

IllegalArgumentExceptioncom.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 True then the content of range will be replaced by content, otherwise content will be inserted at the end of xRange.

Return type:

None

is_cell_deleted()[source]

Determines if this cell has been deleted.

Returns:

True if cell is deleted; Otherwise, False.

Return type:

bool

New in version 0.45.2.

is_first_column()[source]

Determines if this cell is in the first column of the sheet.

Return type:

bool

is_first_row()[source]

Determines if this cell is in the first row of the sheet.

Return type:

bool

make_constraint(num: int | float, op: str) com.sun.star.sheet.SolverConstraint[source]
make_constraint(num: int | float, op: ooo.lo.sheet.solver_constraint_operator.SolverConstraintOperator) com.sun.star.sheet.SolverConstraint
make_constraint(num, op)

Makes a constraint for a solver model.

Parameters:
  • num (Number) – Constraint number such as float or int.

  • op (str | SolverConstraintOperator) – Operation such as <=.

Returns:

Solver constraint that can be use in a solver model.

Return type:

SolverConstraint

Hint

  • SolverConstraintOperator can be imported from ooo.dyn.sheet.solver_constraint_operator

qi(atype, raise_err=False)

Generic method that get an interface instance from an object.

Parameters:
  • atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface

  • raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False

Raises:

MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None

Returns:

instance of interface if supported; Otherwise, None

Return type:

T | None

Note

When raise_err=True return value will never be None.

refresh()[source]

Refreshes this instance cell.

This method should be call if the sheet has rows or columns inserted or deleted since this instance was created that affect the cell address.

Raises:

CellDeletedError – If the cell has been deleted.

Return type:

None

See also

  • is_cell_deleted()

New in version 0.45.0.

remove_custom_properties()[source]

Removes any custom properties.

Return type:

None

remove_custom_property(name)[source]

Removes a custom property.

Parameters:

name (str) – The name of the property to remove.

Raises:

AttributeError – If the property is a forbidden key.

Return type:

None

remove_event_modified(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_modify_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_text_content(content)

Removes a text content.

Parameters:

content (XTextContent) – the content that is to be removed.

Return type:

None

set_array_cell(values, styles=None)[source]

Inserts array of data into spreadsheet

Parameters:
  • range_name (str) – Range to insert data such as ‘A1:E12’.

  • values (Table) – A 2-Dimensional array of value such as a list of list or tuple of tuples.

  • styles (Sequence[StyleT], optional) – One or more styles to apply to cell range.

Return type:

None

set_custom_properties(properties)[source]

Sets custom properties.

Parameters:

properties (DotDict) – custom properties to set.

Return type:

None

Hint

DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from ooodev.utils.helper.dot_dict.DotDict.

Return type:

None

Parameters:

properties (DotDict) –

set_custom_property(name, value)[source]

Sets a custom property.

Parameters:
  • name (str) – The name of the property.

  • value (Any) – The value of the property.

Raises:

AttributeError – If the property is a forbidden key.

set_date(day, month, year)[source]

Writes a date with standard date format into a spreadsheet

Parameters:
  • day (int) – Date day part.

  • month (int) – Date month part.

  • year (int) – Date year part.

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_row(values)[source]

Inserts a row of data into spreadsheet

Raises:

MissingInterfaceError – if unable to obtain interface

Parameters:

values (Row) – Row Data.

Return type:

None

set_row_height(height)[source]

Sets column width. height is in mm, e.g. 6

Parameters:
  • height (int, UnitT) – Width in mm units or Class UnitT.

  • idx (int) – Index of Row

Raises:

CancelEventError – If SHEET_ROW_HEIGHT_SETTING event is canceled.

Return type:

None

Events:

Note

Event args index is set to idx value, event_data is set to height value (mm100 units).

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_style(styles)[source]

Sets style for cell

Parameters:

styles (Sequence[StyleT]) – One or more styles to apply to cell.

Return type:

None

set_val(value, styles=None)[source]

Sets the value of a cell

Parameters:
  • value (object) – Value for cell.

  • cell_obj (CellObj) – Cell Object.

  • styles (Sequence[StyleT], optional) – One or more styles to apply to cell.

Return type:

None

split_window()[source]

Splits window

Parameters:
  • doc (XSpreadsheetDocument) – Spreadsheet Document

  • cell_name (str) – Cell to preform split on. e.g. ‘C4’

Return type:

None

style_align_orientation(vert_stack=None, rotation=None, edge=None)

Style Text Orientation.

Parameters:
  • vert_stack (bool, optional) – Specifies if vertical stack is to be used.

  • rotation (int, Angle, optional) – Specifies if the rotation.

  • edge (EdgeKind, optional) – Specifies the Reference Edge.

Raises:

CancelEventError – If the event before_style_align_orientation is cancelled and not handled.

Returns:

Text Alignment instance or None if cancelled.

Return type:

TextOrientationT | None

Hint

  • EdgeKind can be imported from ooodev.format.inner.direct.calc.alignment.text_orientation

style_align_orientation_get()

Gets the Alignment Text Orientation Style.

Raises:

CancelEventError – If the event before_style_align_orientation_get is cancelled and not handled.

Returns:

Text Alignment style or None if cancelled.

Return type:

TextOrientationT | None

style_align_properties(*, wrap_auto=None, hyphen_active=None, shrink_to_fit=None, direction=None)

Style Alignment Properties.

Parameters:
  • hori_align (HoriAlignKind, optional) – Specifies Horizontal Alignment.

  • indent – (float, UnitT, optional): Specifies indent in pt (point) units or Class UnitT. Only used when hori_align is set to HoriAlignKind.LEFT

  • vert_align (VertAdjustKind, optional) – Specifies Vertical Alignment.

  • wrap_auto (bool | None) –

  • hyphen_active (bool | None) –

  • shrink_to_fit (bool | None) –

  • direction (TextDirectionKind | None) –

Raises:

CancelEventError – If the event before_style_align_properties is cancelled and not handled.

Returns:

Text Alignment instance or None if cancelled.

Return type:

PropertiesT | None

Hint

  • TextDirectionKind can be imported from ooodev.format.inner.direct.calc.alignment.properties

style_align_properties_get()

Gets the Alignment Properties Style.

Raises:

CancelEventError – If the event before_style_align_properties_get is cancelled and not handled.

Returns:

Text Alignment style or None if cancelled.

Return type:

PropertiesT | None

style_align_text(hori_align=None, indent=None, vert_align=None)

Style Alignment Text.

Parameters:
  • hori_align (HoriAlignKind, optional) – Specifies Horizontal Alignment.

  • indent (float | UnitT | None) – (float, UnitT, optional): Specifies indent in pt (point) units or Class UnitT. Only used when hori_align is set to HoriAlignKind.LEFT

  • vert_align (VertAdjustKind, optional) – Specifies Vertical Alignment.

Raises:

CancelEventError – If the event before_style_align_text is cancelled and not handled.

Returns:

Text Alignment instance or None if cancelled.

Return type:

TextAlignT | None

Hint

  • HoriAlignKind can be imported from ooodev.format.inner.direct.calc.alignment.text_align

  • VertAlignKind can be imported from ooodev.format.inner.direct.calc.alignment.text_align

style_align_text_get()

Gets the Alignment Text Style.

Raises:

CancelEventError – If the event before_style_align_text_get is cancelled and not handled.

Returns:

Text Alignment style or None if cancelled.

Return type:

TextAlignT | None

style_area_color(color=-1)

Style Area Color.

Parameters:

color (Color, optional) – FillColor Color. Defaults to StandardColor.AUTO_COLOR.

Raises:

CancelEventError – If the event before_style_area_color is cancelled and not handled.

Returns:

FillColor instance or None if cancelled.

Return type:

FillColorT | None

style_area_color_get()

Gets the Area Color Style.

Raises:

CancelEventError – If the event before_style_area_color_get is cancelled and not handled.

Returns:

Area color style or None if cancelled.

Return type:

FillColorT | None

style_borders(*, right=None, left=None, top=None, bottom=None, border_side=None, vertical=None, horizontal=None, distance=None, diagonal_down=None, diagonal_up=None, shadow=None, padding=None)

Style Borders.

Parameters:
  • left (Side, optional) – Specifies the line style at the left edge.

  • right (Side, optional) – Specifies the line style at the right edge.

  • top (Side, optional) – Specifies the line style at the top edge.

  • bottom (Side, optional) – Specifies the line style at the bottom edge.

  • border_side (Side, optional) – Specifies the line style at the top, bottom, left, right edges. If this argument has a value then arguments top, bottom, left, right are ignored

  • horizontal (Side, optional) – Specifies the line style of horizontal lines for the inner part of a cell range.

  • vertical (Side, optional) – Specifies the line style of vertical lines for the inner part of a cell range.

  • distance (float, UnitT, optional) – Contains the distance between the lines and other contents in mm units or Class UnitT.

  • diagonal_down (Side, optional) – Specifies the line style from top-left to bottom-right diagonal.

  • diagonal_up (Side, optional) – Specifies the line style from bottom-left to top-right diagonal.

  • shadow (Shadow, optional) – Cell Shadow.

  • padding (padding, optional) – Cell padding.

Raises:

CancelEventError – If the event before_style_calc_borders is cancelled and not handled.

Returns:

Border instance or None if cancelled.

Return type:

BordersT | None

Hint

  • Side, Shadow and Padding can be imported from ooodev.format.calc.direct.cell.borders

  • BorderLineKind can be imported from ooodev.format.calc.direct.cell.borders

  • LineSize can be imported from ooodev.format.calc.direct.cell.borders

style_borders_clear()

Clear Borders Styles.

Return type:

None

style_borders_default()

Style default border.

Returns:

Border instance or None if cancelled.

Return type:

BordersT | None

style_borders_get()

Gets the Borders Style.

Raises:

CancelEventError – If the event before_style_calc_borders_get is cancelled and not handled.

Returns:

border style or None if cancelled.

Return type:

BordersT | None

style_borders_sides(*, line=None, color=None, width=None, distance=None, shadow=None, padding=None, hori=False, vert=False)

Style All border to specified line properties. This method is a subset of style_borders() method for convenience.

Parameters:
  • line (BorderLineStyleEnum, optional) – Line Style of the border. Default BorderLineKind.SOLID.

  • color (Color, optional) – Color of the border. Default StandardColor.BLACK

  • width (LineSize, float, UnitT, optional) – Contains the width in of a single line or the width of outer part of a double line (in pt units) or Class UnitT. If this value is zero, no line is drawn. Default LineSize.THIN

  • distance (float, UnitT, optional) – Contains the distance between the lines and other contents in mm units or Class UnitT.

  • shadow (Shadow, optional) – Cell Shadow.

  • padding (padding, optional) – Cell padding.

  • hori (bool, optional) – If True then horizontal lines are also styled.

  • vert (bool, optional) – If True then vertical lines are also styled.

Raises:

CancelEventError – If the event before_style_calc_borders is cancelled and not handled.

Returns:

Font Effects instance or None if cancelled.

Return type:

BordersT | None

Hint

  • Shadow and Padding can be imported from ooodev.format.calc.direct.cell.borders

  • BorderLineKind can be imported from ooodev.format.calc.direct.cell.borders

  • LineSize can be imported from ooodev.format.calc.direct.cell.borders

style_by_name(name='')[source]

Assign a style by name to the component.

Parameters:

name (str, StyleCellKind, optional) – The name of the style to apply. StyleCellKind contains various style names. If not provided, the default style is applied.

Raises:

CancelEventError – If the event before_style_by_name is cancelled and not handled.

Return type:

None

Hint

  • StyleCellKind can be imported from ooodev.format.calc.style

style_by_name_get()

Get the style name of the component.

Returns:

The name of the style.

Return type:

str

style_font(name=None, size=None, font_style=None, lang=None)

Style Font.

Parameters:
  • name (str | None, optional) – Font Name.

  • size (float | UnitT | None, optional) – Font Size in PT units or UnitT.

  • font_style (str | None, optional) – Font Style such as Bold Italics

  • lang (FontLangT | None, optional) – Font Language.

Raises:

CancelEventError – If the event before_style_font_only is cancelled and not handled.

Returns:

Font Only instance or None if cancelled.

Return type:

FontOnlyT | None

See also

FontLang

style_font_effect(*, color=None, transparency=None, overline=None, underline=None, strike=None, word_mode=None, case=None, relief=None, outline=None, shadowed=None)

Style Font options.

Parameters:
  • color (Color, optional) – The value of the text color. If value is -1 the automatic color is applied.

  • transparency (Intensity, int, optional) – The transparency value from 0 to 100 for the font color.

  • overline (FontLine, optional) – Character overline values.

  • underline (FontLine, optional) – Character underline values.

  • strike (FontStrikeoutEnum, optional) – Determines the type of the strike out of the character.

  • word_mode (bool, optional) – If True, the underline and strike-through properties are not applied to white spaces.

  • case (CaseMapEnum, optional) – Specifies the case of the font.

  • relief (FontReliefEnum, optional) – Specifies the relief of the font.

  • outline (bool, optional) – Specifies if the font is outlined.

  • shadowed (bool, optional) – Specifies if the characters are formatted and displayed with a shadow effect.

Raises:

CancelEventError – If the event before_style_font_effect is cancelled and not handled.

Returns:

Font Effects instance or None if cancelled.

Return type:

FontEffectsT | None

Hint

  • CaseMapEnum can be imported from ooo.dyn.style.case_map

  • FontReliefEnum can be imported from ooo.dyn.awt.font_relief

  • FontStrikeoutEnum can be imported from ooo.dyn.awt.font_strikeout

  • FontLine can be imported from ooodev.format.inner.direct.write.char.font.font_effects

  • Intensity can be imported from ooodev.utils.data_type.intensity

  • FontUnderlineEnum can be imported from ooo.dyn.awt.font_underline

style_font_effect_get()

Gets the font effect Style.

Raises:

CancelEventError – If the event before_style_font_effect_get is cancelled and not handled.

Returns:

Font Effect style or None if cancelled.

Return type:

FontEffectsT | None

style_font_effect_line(line=None, color=None, overline=False)

Style Font Underline or Overline.

This method is a subset of style_font_effect() method for convenience.

Parameters:
  • color (Color, optional) – The value of the text color. If value is -1 the automatic color is applied.

  • line (FontUnderlineEnum, optional) – Font Line kind.

  • overline (bool, optional) – If True the line is overline, otherwise it is underline.

Raises:

CancelEventError – If the event before_style_font_effect is cancelled and not handled.

Returns:

Font Effects instance or None if cancelled.

Return type:

FontEffectsT | None

Hint

  • FontUnderlineEnum can be imported from ooo.dyn.awt.font_underline

style_font_general(b=None, i=None, u=None, bg_color=None, bg_transparent=None, charset=None, color=None, family=None, name=None, overline=None, rotation=None, shadow_fmt=None, shadowed=None, size=None, slant=None, spacing=None, strike=None, subscript=None, superscript=None, underline=None, weight=None, word_mode=None)

Style Font.

Parameters:
  • b (bool, optional) – Shortcut to set weight to bold.

  • i (bool, optional) – Shortcut to set slant to italic.

  • u (bool, optional) – Shortcut ot set underline to underline.

  • bg_color (Color, optional) – The value of the text background color.

  • bg_transparent (bool, optional) – Determines if the text background color is set to transparent.

  • charset (CharSetEnum, optional) – The text encoding of the font.

  • color (Color, optional) – The value of the text color. Setting to -1 will cause automatic color.

  • family (FontFamilyEnum, optional) – Font Family.

  • name (str, optional) – This property specifies the name of the font style. It may contain more than one name separated by comma.

  • overline (FontLine, optional) – Character overline values.

  • rotation (int, Angle, optional) – Specifies the rotation of a character in degrees. Depending on the implementation only certain values may be allowed.

  • shadow_fmt (ShadowFormat | None) – (ShadowFormat, optional): Determines the type, color, and width of the shadow.

  • shadowed (bool, optional) – Specifies if the characters are formatted and displayed with a shadow effect.

  • size (float, UnitT, optional) – This value contains the size of the characters in pt (point) units or Class UnitT.

  • slant (FontSlant, optional) – The value of the posture of the document such as FontSlant.ITALIC.

  • spacing (CharSpacingKind, float, UnitT, optional) – Specifies character spacing in pt (point) units or Class UnitT.

  • strike (FontStrikeoutEnum, optional) – Determines the type of the strike out of the character.

  • subscript (bool, optional) – Subscript option.

  • superscript (bool, optional) – Superscript option.

  • underline (FontLine, optional) – Character underline values.

  • weight (FontWeightEnum, optional) – The value of the font weight.

  • word_mode (bool, optional) – If True, the underline and strike-through properties are not applied to white spaces.

Raises:

CancelEventError – If the event before_style_general_font is cancelled and not handled.

Returns:

Font instance or None if cancelled.

Return type:

FontT | None

Hint

  • FontFamilyEnum can be imported from ooo.dyn.awt.font_family

  • CharSetEnum can be imported from ooo.dyn.awt.char_set

  • ShadowFormat can be imported from ooo.dyn.table.shadow_format

  • FontSlant can be imported from ooo.dyn.awt.font_slant

  • FontStrikeoutEnum can be imported from ooo.dyn.awt.font_strikeout

  • FontWeightEnum can be imported from ooo.dyn.awt.font_weight

  • FontLine can be imported from ooodev.format.inner.direct.write.char.font.font_effects

  • CharSpacingKind can be imported from ooodev.format.inner.direct.write.char.font.font_position

style_font_get()

Gets the font Style.

Raises:

CancelEventError – If the event before_style_font_only_get is cancelled and not handled.

Returns:

Font style or None if cancelled.

Return type:

FontOnlyT | None

style_numbers_boolean()

Style numbers boolean.

Return type:

NumbersT | None

style_numbers_currency()

Style numbers currency.

Return type:

NumbersT | None

style_numbers_date()

Style numbers date.

Return type:

NumbersT | None

style_numbers_datetime()

Style numbers datetime.

Return type:

NumbersT | None

style_numbers_fraction()

Style numbers fraction.

Return type:

NumbersT | None

style_numbers_general()

Style numbers general.

Return type:

NumbersT | None

style_numbers_number()

Style numbers number.

Return type:

NumbersT | None

style_numbers_numbers(num_format=0, num_format_index=-1, lang_locale=None)

Style numbers numbers.

Parameters:
  • num_format (NumberFormatEnum, int, optional) – Type of a number format. Use this to select a default format. Defaults to 0 (General Format). Only used if num_format_index is -1 (omitted).

  • num_format_index (NumberFormatIndexEnum, int, optional) – Index of a number format. The enumeration values represent the built-in number formats. Defaults to -1.

  • lang_locale (Locale, optional) – Locale of the number format. Defaults to None which used current Locale.

Raises:

CancelEventError – If the event before_style_number_number is cancelled and not handled.

Returns:

Style Numbers instance or None if cancelled.

Return type:

NumbersT | None

Hint

  • NumberFormatEnum can be imported from ooo.dyn.util.number_format

  • NumberFormatIndexEnum can be imported from ooo.dyn.i18n.number_format_index

  • Locale can be imported from ooo.dyn.lang.locale

style_numbers_numbers_get()

Gets the Numbers Style.

Raises:

CancelEventError – If the event before_style_number_number_get is cancelled and not handled.

Returns:

Numbers style or None if cancelled.

Return type:

NumbersT | None

style_numbers_numbers_get_from_index(idx, locale=None)

Gets the Numbers Style.

Raises:

CancelEventError – If the event before_style_number_number_from_index is cancelled and not handled.

Returns:

Numbers style or None if cancelled.

Return type:

NumbersT | None

Parameters:
  • idx (int) –

  • locale (Locale | None) –

Hint

  • Locale can be imported from ooo.dyn.lang.locale

style_numbers_numbers_get_from_str(nf_str, locale=None, auto_add=False)

Gets the Numbers Style.

Parameters:
  • nf_str (str) – Format string.

  • lang_locale (Locale, optional) – Locale. Defaults to None.

  • auto_add (bool, optional) – If True, format string will be added to document if not found. Defaults to False.

  • source_format (bool, optional) – If True, the number format will be linked to the source format. Defaults to False.

  • locale (Locale | None) –

Raises:

CancelEventError – If the event before_style_number_number_from_index is cancelled and not handled.

Returns:

Numbers style or None if cancelled.

Return type:

NumbersT | None

Hint

  • Locale can be imported from ooo.dyn.lang.locale

style_numbers_percent()

Style numbers percent.

Return type:

NumbersT | None

style_numbers_scientific()

Style numbers scientific.

Return type:

NumbersT | None

style_numbers_time()

Style numbers time.

Return type:

NumbersT | None

style_protection(hide_all=False, protected=False, hide_formula=False, hide_print=False)

Style cell protection.

AArgs:

hide_all (bool, optional): Specifies if all is hidden. Defaults to False. protected (bool, optional): Specifies protected value. Defaults to False. hide_formula (bool, optional): Specifies if the formula is hidden. Defaults to False. hide_print (bool, optional): Specifies if the cell are to be omitted during print. Defaults to False.

Raises:

CancelEventError – If the event before_style_cell_protection is cancelled and not handled.

Returns:

Attribute Options Style instance or None if cancelled.

Return type:

CellProtection | None

Parameters:
  • hide_all (bool) –

  • protected (bool) –

  • hide_formula (bool) –

  • hide_print (bool) –

Hint

PlacementKind, SeparatorKind and CellProtection can be imported from ooodev.format.inner.direct.chart2.series.data_labels.data_labels.attrib_options

style_protection_get()

Gets the cell protection Style.

Raises:

CancelEventError – If the event before_style_cell_protection_get is cancelled and not handled.

Returns:

Number percent style or None if cancelled.

Return type:

PercentFormat | 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

support_service(*service)

Gets if instance supports a service.

Parameters:

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

Returns:

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

Return type:

bool

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 asian_vertical_mode: bool | None

Gets/Sets Asian character orientation in vertical orientation.

If the CellProperties.Orientation property is CellOrientation.STACKED, in Asian mode only Asian characters are printed in horizontal orientation instead of all characters. For other values of CellProperties.Orientation, this value is not used.

optional

Return type:

bool | None

property bottom_border: BorderLineStructComp

Gets/Sets a description of the bottom border line of each cell.

Setting value can be done with a BorderLine or BorderLineStructComp object.

Returns:

Returns Border Line.

Return type:

BorderLineStructComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property bottom_border2: BorderLine2StructComp

Gets/Sets a description of the bottom border line of each cell.

Preferred over bottom_border.

Setting value can be done with a BorderLine2 or BorderLine2StructComp object.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property calc_cell: CalcCell

Chart Document.

Return type:

CalcCell

property calc_doc: Any

Calc Document.

Return type:

CalcDoc

property calc_sheet: Any

Calc Sheet.

Return type:

CalcSheet

property cell_back_color: Color

Gets/Sets the cell background color.

Returns:

Returns Color.

Return type:

Color

property cell_interop_grab_bag: Tuple[PropertyValue, ...] | None

Gets/Sets Grab bag of cell 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 cell_obj: CellObj

Cell object.

Return type:

CellObj

property cell_protection: CellProtectionStructComp

Gets/Sets a description of the cell protection.

Cell protection is active only if the sheet is protected.

Return type:

CellProtectionStructComp

property cell_style: str

Gets/Sets the name of the style of the cell.

Return type:

str

property component: com.sun.star.sheet.SheetCell

Sheet Cell Component

Return type:

SheetCell

property control: CellControl

Gets access to class for managing cell control.

Returns:

Cell control instance.

Return type:

CellControl

property diagonal_bltr: BorderLineStructComp

Gets/Sets a description of the bottom left to top right diagonal line of each cell.

Setting value can be done with a BorderLine or BorderLineComp object.

Returns:

Returns Border Line.

Return type:

BorderLineComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property diagonal_bltr2: BorderLine2StructComp

Gets/Sets a description of the bottom left to top right diagonal line of each cell.

Preferred over diagonal_bltr.

Setting value can be done with a BorderLine2 or BorderLine2StructComp object.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property diagonal_tlbr: BorderLineStructComp

Gets/Sets a description of the top left to bottom right diagonal line of each cell.

Setting value can be done with a BorderLine or BorderLineComp object.

Returns:

Returns BorderLine.

Return type:

BorderLineComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property diagonal_tlbr2: BorderLine2StructComp

contains a description of the top left to bottom right diagonal line of each cell.

Preferred over diagonal_tlbr.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

property events_listener_modify: ModifyListener

Returns listener

Return type:

ModifyListener

property hori_justify: CellHoriJustify

Gets/Sets the horizontal alignment of the cell contents.

Returns:

Returns Horizontal Justify.

Return type:

CellHoriJustify

Hint

  • CellHoriJustifyProto can be imported from ooo.dyn.table.cell_hori_justify

property is_cell_background_transparent: bool

Gets/Sets - is True, if the cell background is transparent.

In this case the CellProperties.CellBackColor value is not used.

Return type:

bool

property is_text_wrapped: bool

Gets/Sets - is True, if text in the cells will be wrapped automatically at the right border.

Return type:

bool

property left_border: BorderLineStructComp

Gets/Sets a description of the left border line of each cell.

Setting value can be done with a BorderLine or BorderLineStructComp object.

Returns:

Returns Border Line.

Return type:

BorderLineStructComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property left_border2: BorderLine2StructComp

Gets/Sets a description of the left border line of each cell.

Preferred over left_border.

Setting value can be done with a BorderLine2 or BorderLine2StructComp object.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

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.NumberFormatter interface of the document.

Return type:

int

property office_doc: object

Office Document.

Return type:

OfficeDocumentT

property orientation: CellOrientation

Gets/Sets the orientation of the cell contents.

If the CellProperties.RotateAngle property is non-zero, this value is not used.

Returns:

Returns Cell Orientation.

Return type:

CellOrientation

Hint

  • CellOrientation can be imported from ooo.dyn.table.cell_orientation

property para_indent: UnitMM100

Gets/Sets the indentation of the cell contents (in 1/100 mm).

The value can be set with an integer (in 1/100 mm) or an UnitT object.

Returns:

Returns UnitMM100 object (unit 1/100 mm).

Return type:

UnitMM100

property position: GenericUnitPoint[UnitMM, float]

Gets the Position of the cell in UnitMM Values.

Contains the position of the top left cell of this range.

This property contains the absolute position in the whole sheet, not the position in the visible area.

Changed in version 0.20.1: Now return Class GenericUnitPoint instead of Point.

Return type:

GenericUnitPoint[UnitMM, float]

property right_border: BorderLineStructComp

Gets/Sets a description of the right border line of each cell.

Setting value can be done with a BorderLine or BorderLineStructComp object.

Returns:

Returns Border Line.

Return type:

BorderLineStructComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property right_border2: BorderLine2StructComp

Gets/Sets a description of the right border line of each cell.

Setting value can be done with a BorderLine2 or BorderLine2StructComp object.

Preferred over right_border.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property rotate_angle: Angle100

Gets/Sets how much the content of cells is rotated (in 1/100 degrees).

The value can be set with an integer (in 1/100 degrees) or an AngleT object.

Return type:

Angle100

property rotate_reference: CellVertJustify2Enum

Gets/Sets at which edge rotated cells are aligned.

Returns:

Returns CellVertJustify2Enum.

Return type:

CellVertJustify2Enum

Hint

  • CellVertJustify2Enum can be imported from ooo.dyn.table.cell_vert_justify2

property shadow_format: ShadowFormatStructComp

Gets/Sets a description of the shadow.

When setting the value can be an instance of ShadowFormatStructComp or ShadowFormat.

Returns:

Shadow Format

Return type:

ShadowFormatStructComp

Hint

  • ShadowFormat can be imported from ooo.dyn.table.shadow_format

property shrink_to_fit: bool | None

Gets/Sets - is True, if the cell content will be shrunk to fit in the cell.

optional

Return type:

bool | None

property table_border: TableBorderStructComp

contains a description of the cell or cell range border.

If used with a cell range, the top, left, right, and bottom lines are at the edges of the entire range, not at the edges of the individual cell.

Setting value can be done with a TableBorder or TableBorderStructComp object.

Returns:

Table Border.

Return type:

TableBorderComp

Hint

  • TableBorder can be imported from ooo.dyn.table.table_border

property table_border2: TableBorder2StructComp

Gets/Seta a description of the cell or cell range border.

Preferred over table_border.

If used with a cell range, the top, left, right, and bottom lines are at the edges of the entire range, not at the edges of the individual cell.

Setting value can be done with a TableBorder2 or TableBorder2StructComp object.

Returns:

Returns TableBorder2 or None if not supported.

Return type:

TableBorder2StructComp | None

Hint

  • TableBorder2 can be imported from ooo.dyn.table.table_border2

property top_border: BorderLineStructComp

Gets/Sets a description of the top border line of each cell.

Setting value can be done with a BorderLine or BorderLineStructComp object.

Returns:

Returns Border Line.

Return type:

BorderLineStructComp

Hint

  • BorderLine can be imported from ooo.dyn.table.border_line

property top_border2: BorderLine2StructComp

Gets/Sets a description of the top border line of each cell.

Preferred over top_border.

Setting value can be done with a BorderLine2 or BorderLine2StructComp object.

Returns:

Returns BorderLine2.

Return type:

BorderLine2StructComp

Hint

  • BorderLine2 can be imported from ooo.dyn.table.border_line2

property user_defined_attributes: NameContainerComp | None

Gets/Sets - stores additional attributes.

This property is used i.e. by the XML filters to load and restore unknown attributes.

Return type:

NameContainerComp | None

property value: str | float | None

Gets/Sets the value of cell.

If the cell has a value, then the value is returned; Otherwise, None is returned.

New in version 0.20.1.

Return type:

str | float | None

property vert_justify: CellVertJustify2Enum

Gets/Sets the vertical alignment of the cell contents.

When setting the value, it can be an integer or an instance of CellVertJustify2Enum.

Returns:

Returns Vertical Justify.

Return type:

CellVertJustify2Enum

Hint

  • CellVertJustify2Enum can be imported from ooo.dyn.table.cell_vert_justify2