ooodev.format.inner.direct.write.table.props.table_properties module
- class ooodev.format.inner.direct.write.table.props.table_properties.TableAlignKind(value)[source]
Bases:
Enum
An enumeration.
- AUTO = 6
The object uses the full space (for text tables only).
- CENTER = 2
The object is aligned at the middle.
- FROM_LEFT = 7
The left offset and the width of the object are defined.
For text tables this means that the tables position is defined by the left margin and the width.
- LEFT = 3
The object is aligned at the left side.
- MANUAL = 0
No hard alignment is applied.
- RIGHT = 1
The object is aligned at the right side.
- class ooodev.format.inner.direct.write.table.props.table_properties.TableProperties(*, name=None, width=None, left=None, right=None, above=None, below=None, align=None, relative=False)[source]
Bases:
StyleMulti
Table options.
Table horizontal position can be modified in many ways. This class generally follow how value are entered into the Table Properties dialog box of writer.
name
,above
andbelow
parameters values are accepted for all states.When
relative
isTrue
the following are required.align=TableAlignKind.AUTO
, Not supported. RaisesValueError
.align=TableAlignKind.CENTER
,width
andleft
are required.align=TableAlignKind.FROM_LEFT
,width
andleft
are required.align=TableAlignKind.LEFT
,width
orright
are required.align=TableAlignKind.MANUAL
, Not supported. RaisesValueError
.align=TableAlignKind.RIGHT
,width
orleft
are required.
When
relative
isFalse
the following are required.align=TableAlignKind.AUTO
, no extra parameters are required.align=TableAlignKind.CENTER
,width
orleft
are required.align=TableAlignKind.FROM_LEFT
,width
orleft
are required.align=TableAlignKind.LEFT
,width
orright
is required.align=TableAlignKind.MANUAL
,width
,left
andright
are required.align=TableAlignKind.RIGHT
,width
orleft
is required.
New in version 0.9.0.
- __init__(*, name=None, width=None, left=None, right=None, above=None, below=None, align=None, relative=False)[source]
Constructor
- Parameters:
name (str, optional) – Specifies frame name. Space are NOT allowed in names
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
mm
units.
- Raises:
ValueError – If name contains spaces.
- Return type:
None
- apply(obj, **kwargs)[source]
Applies styles to object
- Parameters:
obj (object) – UNO object.
- Return type:
None
- classmethod from_obj(obj)[source]
- classmethod from_obj(obj, **kwargs)
- classmethod from_obj(obj, **kwargs)
Gets instance from object
- Parameters:
obj (object) – UNO Object.
- Raises:
NotSupportedError – If
obj
is not supported.- Returns:
Instance that represents Table options.
- Return type:
- get_left_mm()[source]
Gets left in
mm
units.When class is constructed using relative values this method will still return
mm
units.- Return type:
UnitMM | None
Note
This method may return None if
apply()
has not yet been called.
- get_right_mm()[source]
Gets right in
mm
units.When class is constructed using relative values this method will still return
mm
units.- Return type:
UnitMM | None
Note
This method may return None if
apply()
has not yet been called.
- get_width_mm()[source]
Gets Width in
mm
units.When class is constructed using relative values this method will still return
mm
units.- Return type:
UnitMM | None
Note
This method may return None if
apply()
has not yet been called.
- on_property_setting(source, event_args)[source]
Triggers for each property that is set
- Parameters:
source (Any) – Event Source.
event_args (KeyValueCancelArgs) – Event Args
- Return type:
None
- property prop_align: TableAlignKind | None
Gets Alignment value
- Return type:
TableAlignKind | None
- property prop_format_kind: FormatKind
Gets the kind of style
- Return type:
- property prop_left: UnitMM | Intensity | None
Gets left value.
- Returns:
When
relative
isTrue
Intensity
orNone
; Otherwise,UnitMM
or None.- Return type:
See also
- property prop_name: str | None
Gets/Sets name
- Return type:
str | None
- property prop_relative: bool
Gets relative value
- Return type:
bool