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 and below parameters values are accepted for all states.

When relative is True the following are required.

  • align=TableAlignKind.AUTO, Not supported. Raises ValueError.

  • align=TableAlignKind.CENTER, width and left are required.

  • align=TableAlignKind.FROM_LEFT, width and left are required.

  • align=TableAlignKind.LEFT, width or right are required.

  • align=TableAlignKind.MANUAL, Not supported. Raises ValueError.

  • align=TableAlignKind.RIGHT, width or left are required.

When relative is False the following are required.

  • align=TableAlignKind.AUTO, no extra parameters are required.

  • align=TableAlignKind.CENTER, width or left are required.

  • align=TableAlignKind.FROM_LEFT, width or left are required.

  • align=TableAlignKind.LEFT, width or right is required.

  • align=TableAlignKind.MANUAL, width, left and right are required.

  • align=TableAlignKind.RIGHT, width or left 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:

TableProperties

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_above: UnitMM | None

Gets above value

Return type:

UnitMM | None

property prop_align: TableAlignKind | None

Gets Alignment value

Return type:

TableAlignKind | None

property prop_below: UnitMM | None

Gets below value

Return type:

UnitMM | None

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_left: UnitMM | Intensity | None

Gets left value.

Returns:

When relative is True Intensity or None; Otherwise, UnitMM or None.

Return type:

UnitMM | Intensity | None

See also

get_left_mm().

property prop_name: str | None

Gets/Sets name

Return type:

str | None

property prop_relative: bool

Gets relative value

Return type:

bool

property prop_right: UnitMM | Intensity | None

Gets right value.

Returns:

When relative is True Intensity or None; Otherwise, UnitMM or None.

Return type:

UnitMM | Intensity | None

See also

get_right_mm().

property prop_width: UnitMM | Intensity | None

Gets width value.

Returns:

When relative is True Intensity or None; Otherwise, UnitMM or None.

Return type:

UnitMM | Intensity | None

See also

get_width_mm().