ooodev.format.inner.direct.write.para.align.alignment module

Module for managing paragraph alignment.

New in version 0.9.0.

class ooodev.format.inner.direct.write.para.align.alignment.Alignment(*, align=None, align_vert=None, txt_direction=None, align_last=None, expand_single_word=None, snap_to_grid=None)[source]

Bases: StyleMulti

Paragraph Alignment

Any properties starting with prop_ set or get current instance values.

All methods starting with fmt_ can be used to chain together properties.

New in version 0.9.0.

__init__(*, align=None, align_vert=None, txt_direction=None, align_last=None, expand_single_word=None, snap_to_grid=None)[source]

Constructor

Parameters:
  • align (ParagraphAdjust, optional) – Determines horizontal alignment of a paragraph.

  • align_vert (ParagraphVertAlignEnum, optional) – Determines vertical alignment of a paragraph.

  • text_direction (WritingMode, optional) – Determines the text direction.

  • align_last (LastLineKind, optional) – Determines the adjustment of the last line.

  • expand_single_word (bool, optional) – Determines if single words are stretched. It is only valid if align and align_last are also valid.

  • snap_to_grid (bool, optional) – Determines snap to text grid (if active).

  • txt_direction (WritingMode | None) –

Return type:

None

Hint

  • ParagraphAdjust can be imported from ooo.dyn.style.paragraph_adjust

  • ParagraphVertAlignEnum can be imported from ooo.dyn.text.paragraph_vert_align

  • LastLineKind can be imported from ooodev.format.writer.direct.para.alignment

  • WritingMode can be imported from ooodev.format.inner.direct.write.para.align

  • WritingMode2Enum can be imported from oo.dyn.text.writing_mode2.

apply(obj: Any)[source]
apply(obj: Any, **kwargs)
apply(obj, **kwargs)

Applies alignment to obj

Parameters:

obj (object) – UNO object that supports com.sun.star.style.ParagraphProperties service.

Return type:

None

static convert_int_to_paragraph_adjust(num)[source]

Converts integer value to ParagraphAdjust.

When Writer saves ParagraphAdjust value into ParaAdjust it converts it to a integer value.

Parameters:

num (int) – Number to convert

Returns:

Number as ParagraphAdjust

Return type:

ParagraphAdjust

fmt_align(value)[source]

Gets copy of instance with horizontal alignment set or removed

Parameters:
  • value (ParagraphAdjust | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_align_last(value)[source]

Gets copy of instance with align last set or removed

Parameters:
  • value (LastLineKind | None) – Align last value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_align_vert(value)[source]

Gets copy of instance with vertical alignment set or removed

Parameters:
  • value (ParagraphVertAlignEnum | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_expand_single_word(value)[source]

Gets copy of instance with expand single word set or removed

Parameters:
  • value (LastLineKind | None) – Expand single word value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_snap_to_grid(value)[source]

Gets copy of instance with snap to grid set or removed

Parameters:
  • value (LastLineKind | None) – Snap to grid value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

fmt_txt_direction(value)[source]

Gets copy of instance with vertical alignment set or removed

Parameters:
  • value (ParagraphVertAlignEnum | None) – Alignment value

  • self (_TAlignment) –

Returns:

Alignment instance

Return type:

Alignment

classmethod from_obj(obj)[source]
classmethod from_obj(obj, **kwargs)
classmethod from_obj(obj, **kwargs)

Gets Padding instance from object

Parameters:

obj (object) – UNO object.

Raises:

NotSupportedError – If obj is not supported.

Returns:

Alignment that represents obj alignment.

Return type:

Alignment

property align_center: _TAlignment

Gets copy of instance with align set to center

Return type:

TypeVar(_TAlignment, bound= Alignment)

property align_left: _TAlignment

Gets copy of instance with align set to left

Return type:

TypeVar(_TAlignment, bound= Alignment)

property align_right: _TAlignment

Gets copy of instance with align set to left

Return type:

TypeVar(_TAlignment, bound= Alignment)

property default: _TAlignment

Gets Alignment default.

Return type:

TypeVar(_TAlignment, bound= Alignment)

property expand_single_word: _TAlignment

Gets copy of instance with expand single word set

Return type:

TypeVar(_TAlignment, bound= Alignment)

property justified: _TAlignment

Gets copy of instance with align set to block

Return type:

TypeVar(_TAlignment, bound= Alignment)

property prop_align: ParagraphAdjust | None

Gets/Sets horizontal alignment of a paragraph.

Return type:

ParagraphAdjust | None

property prop_align_last: LastLineKind | None

Gets/Sets the adjustment of the last line.

Return type:

LastLineKind | None

property prop_align_vert: ParagraphVertAlignEnum | None

Gets/Sets vertical alignment of a paragraph.

Return type:

ParagraphVertAlignEnum | None

property prop_expand_single_word: bool | None

Gets/Sets Determines if single words are stretched.

It is only valid if prop_align and prop_align_last are also valid.

Return type:

bool | None

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_inner_mode: WritingMode | None

Gets Writing Mode (txt_direction) instance if exist.

Return type:

WritingMode | None

property prop_snap_to_grid: bool | None

Gets/Sets snap to text grid (if active).

Return type:

bool | None

property snap_to_grid: _TAlignment

Gets copy of instance with snap to grid set

Return type:

TypeVar(_TAlignment, bound= Alignment)

class ooodev.format.inner.direct.write.para.align.alignment.LastLineKind(value)[source]

Bases: Enum

Last Line Alignment kind

CENTER = 3

Align Center

JUSTIFY = 2

Align justified

START = 0

Align Start