Class TableStyler
- class ooodev.write.style.direct.table.table_styler.TableStyler(owner, component)[source]
Bases:
WriteDocPropPartial,WriteTablePropPartial,EventsPartial,LoInstPropsPartial,FillColorPartial,WriteTableFillImgPartial,WriteTableBordersPartial,WriteTablePropertiesPartial,TheDictionaryPartialCell Styler class.
Class set various cell properties.
Events are raises when a style is being applied and when a style has been applied. The
WriteNamedEvent.TABLE_STYLE_APPLYINGevent is raised before a style is applied. TheWriteNamedEvent.TABLE_STYLE_APPLIEDevent is raised after a style has been applied. The event data is a dictionary that contains the following:cancel_apply: If set toTruethe style will not be applied. This is only used in theTABLE_STYLE_APPLYINGevent.this_component: The component that the style is being applied to. This is the normally same component passed to the constructor.styler_object: The style that is being applied. This isNonewhenTABLE_STYLE_APPLYINGis raised. Is the style that was applied whenTABLE_STYLE_APPLIEDis raised.
Other style specific data is also in the dictionary such as the parameter values used to apply the style.
The
event_args.event_sourceis the instance of theCellStylerclass.- Parameters:
owner (WriteTable) –
component (Any) –
- __init__(owner, component)[source]
Constructor.
- Parameters:
owner (WriteTable) – Write Table instance.
component (Any) – component instance.
- 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.
- 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
- style_area_color(color=-1)
Style Area Color.
- Parameters:
color (
Color, optional) – FillColor Color. Defaults toStandardColor.AUTO_COLOR.- Raises:
CancelEventError – If the event
before_style_area_coloris cancelled and not handled.- Returns:
FillColor instance or
Noneif cancelled.- Return type:
FillColorT | None
- style_area_color_get()
Gets the Area Color Style.
- Raises:
CancelEventError – If the event
before_style_area_color_getis cancelled and not handled.- Returns:
Area color style or
Noneif cancelled.- Return type:
FillColorT | None
- style_area_image(*, bitmap=None, name='', mode=ImgStyleKind.TILED, size=None, position=None, pos_offset=None, tile_offset=None, auto_name=False)
Style Area Color.
- Parameters:
bitmap (XBitmap, optional) – Bitmap instance. If
nameis not already in the Bitmap Table then this property is required.name (str, optional) – Specifies the name of the image. This is also the name that is used to store bitmap in LibreOffice Bitmap Table.
mode (ImgStyleKind, optional) – Specifies the image style, tiled, stretched etc. Default
ImgStyleKind.TILED.size (SizePercent, SizeMM, optional) – Size in percent (
0 - 100) or size inmmunits.position (RectanglePoint) – Tiling position of Image.
pos_offset (Offset, optional) – Tiling position offset.
tile_offset (OffsetColumn, OffsetRow, optional) – The tiling offset.
auto_name (bool, optional) – Specifies if
nameis ensured to be unique. Defaults toFalse.
- Raises:
CancelEventError – If the event
before_style_area_imgis cancelled and not handled.- Returns:
Fill Image instance or
Noneif cancelled.- Return type:
FillImgT | None
Hint
RectanglePointcan be imported fromooo.dyn.drawing.rectangle_pointImgStyleKindcan be imported fromooodev.format.inner.direct.write.fill.area.imgSizePercentcan be imported fromooodev.format.inner.common.format_types.size_percentSizeMMcan be imported fromooodev.utils.data_type.size_mmOffsetColumncan be imported fromooodev.format.inner.common.format_types.offset_columnOffsetRowcan be imported fromooodev.format.inner.common.format_types.offset_rowOffsetcan be imported fromooodev.utils.data_type.offset
- style_area_image_from_preset(preset)
Style Area Gradient from Preset.
- Parameters:
preset (PresetImageKind) – Preset Image Kind.
- Returns:
Chart Fill Image instance.
- Return type:
Hint
PresetImageKindcan be imported fromooodev.format.inner.preset.preset_image
- style_borders(*, right=None, left=None, top=None, bottom=None, border_side=None, vertical=None, horizontal=None, distance=None, shadow=None, padding=None, merge_adjacent=None)
Style Write Table 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,rightare ignoredhorizontal (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
mmunits or Class UnitT.shadow (Shadow | None, optional) – Cell Shadow.
padding (Padding | None, optional) – Cell padding.
merge_adjacent (bool, optional) – Specifies if adjacent line style are to be merged.
- Raises:
CancelEventError – If the event
before_style_table_bordersis cancelled and not handled.- Returns:
Border Style instance or
Noneif cancelled.- Return type:
Borders | None
Hint
BorderLinecan be imported fromooodev.format.writer.direct.char.bordersBorderLine2can be imported fromooodev.format.writer.direct.char.bordersBorderLineKindcan be imported fromooodev.format.writer.direct.char.bordersBorderscan be imported fromooodev.format.writer.direct.char.bordersLineSizecan be imported fromooodev.format.writer.direct.char.bordersPaddingcan be imported fromooodev.format.inner.direct.calc.border.paddingShadowcan be imported fromooodev.format.inner.direct.calc.border.shadowShadowFormatcan be imported fromooodev.format.writer.direct.char.bordersSidecan be imported fromooodev.format.writer.direct.char.borderssidecan be imported fromooodev.format.writer.direct.char.bordersSidescan be imported fromooodev.format.writer.direct.char.bordersShadowLocationcan be importedfrom ooo.dyn.table.shadow_location
- style_borders_padding(*, left=None, right=None, top=None, bottom=None, all_sides=None)
Style Padding for Write Table.
- Parameters:
left (float, UnitT, optional) – Left (in
mmunits) or Class UnitT.right (float, UnitT, optional) – Right (in
mmunits) or Class UnitT.top (float, UnitT, optional) – Top (in
mmunits) or Class UnitT.bottom (float, UnitT, optional) – Bottom (in
mmunits) or Class UnitT.all_sides (float, UnitT, optional) – Left, right, top, bottom (in
mmunits) or Class UnitT. If argument is present thenleft,right,top, andbottomarguments are ignored.
- Raises:
CancelEventError – If the event
before_style_table_bordersis cancelled and not handled.- Returns:
Borders Style instance or
Noneif cancelled.- Return type:
Borders | None
- style_borders_side(*, line=BorderLineKind.SOLID, color=0, width=LineSize.THIN, shadow=None, padding=None)
Style All Write Table Borders.
- Parameters:
line (BorderLineStyleEnum, optional) – Line Style of the border. Default
BorderLineKind.SOLID.color (
Color, optional) – Color of the border. DefaultStandardColor.BLACKwidth (LineSize, float, UnitT, optional) – Contains the width in of a single line or the width of outer part of a double line (in
ptunits) or Class UnitT. If this value is zero, no line is drawn. DefaultLineSize.THINshadow (Shadow | None, optional) – Cell Shadow.
padding (Padding | None, optional) – Cell padding.
- Raises:
CancelEventError – If the event
before_style_table_bordersis cancelled and not handled.- Returns:
Borders Style instance or
Noneif cancelled.- Return type:
Borders | None
Hint
BorderLine2can be imported fromooo.dyn.table.border_line2BorderLinecan be imported fromooo.dyn.table.border_lineBorderLineKindcan be imported fromooodev.format.inner.direct.structs.sideLineSizecan be imported fromooodev.format.inner.direct.structs.sidePaddingcan be imported fromooodev.format.inner.direct.calc.border.paddingShadowcan be imported fromooodev.format.inner.direct.calc.border.shadowShadowFormatcan be imported fromooodev.format.writer.direct.char.bordersShadowLocationcan be importedfrom ooo.dyn.table.shadow_location
- style_table_props(*, width=None, left=None, right=None, above=None, below=None, align=None, relative=False)
Style Write Table Properties.
- Parameters:
width (TblAbsUnit, TblRelUnit, optional) – Specifies table Width.
left (TblAbsUnit, TblRelUnit, optional) – Specifies table Left.
right (TblAbsUnit, TblRelUnit, optional) – Specifies table Right.
above (TblAbsUnit, TblRelUnit, optional) – Specifies table spacing above.
below (TblAbsUnit, TblRelUnit, optional) – Specifies table spacing below.
align (TableAlignKind, optional) – Specifies table alignment.
relative (bool, optional) – Specifies if table horizontal values are in percentages or
mmunits.
- Raises:
CancelEventError – If the event
before_style_table_propertiesis cancelled and not handled.- Returns:
Table Properties Style instance or
Noneif cancelled.- Return type:
TableProperties | None
Hint
TblAbsUnitcan be imported fromooodev.format.inner.direct.write.table.props.table_propertiesTblRelUnitcan be imported fromooodev.format.inner.direct.write.table.props.table_propertiesTableAlignKindcan be imported fromooodev.format.inner.direct.write.table.props.table_properties
- style_table_props_get()
Gets the Table Properties Style.
- Returns:
Table Properties Style instance or
Noneif not available.- Return type:
TableProperties | 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 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 office_doc: OfficeDocumentT
Office Document.
- Return type:
- property write_table: WriteTable[Any]
Write Document.
- Return type:
WriteTable[Any]