Class DrawForm

Writer Form

Introduction

The DrawForm class is can manage a form for a Write document.

Adding Controls

This class has many methods for adding controls to the form. that start with insert_control_ for standard controls and insert_db_control_ for database controls.

Here is an example of adding a button to a form and adding an event handler for the button.

>>> from typing import Any
>>> from ooodev.draw import Draw, DrawDoc
>>> from ooodev.events.args.event_args import EventArgs
>>> from ooodev.form.controls import FormCtlButton
>>>
>>> doc =DrawDoc(Draw.create_draw_doc())
>>> doc.set_visible()
>>> draw_page = doc.slides[0]
>>> frm = draw_page.forms.add_form("MainForm")
>>> print(frm.name)
MainForm
>>> btn = frm.insert_control_button(x=10, y=10, width=40, height=10, label="Button Test")
>>> btn.add_event_action_performed(on_btn_action_preformed)
>>>
>>> def on_btn_action_preformed(
...     src: Any, event: EventArgs, control_src: FormCtlButton, *args, **kwargs
... ) -> None:
...     print(
...         f"Action Performed: '{control_src.model.Label}', Control Name: {control_src.name}"
...     )

Other Examples

An example can be found on Live LibreOffice Python UNO Examples. Example: Build Form.

Class Declaration

class ooodev.draw.DrawForm(owner, component, lo_inst=None)[source]

Bases: LoInstPropsPartial, OfficeDocumentPropPartial, DataFormComp, QiPartial, TheDictionaryPartial, FormPartial, ServicePartial

Draw Form class

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

Constructor.

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

  • owner (DrawForms) –

  • component (Form) –

Return type:

None

add_event_container_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_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_element_inserted(cb)

Adds a listener for an event.

Event is invoked when a container has inserted an element.

The callback EventArgs.event_data will contain a UNO com.sun.star.container.ContainerEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_element_removed(cb)

Adds a listener for an event.

Event is invoked when a container has removed an element.

The callback EventArgs.event_data will contain a UNO com.sun.star.container.ContainerEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_element_replaced(cb)

Adds a listener for an event.

Event is invoked when a container has replaced an element.

The callback EventArgs.event_data will contain a UNO com.sun.star.container.ContainerEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

listener (XEventListener) – The event listener to be added.

Return type:

None

add_event_load_events_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_loaded(cb)

Adds a listener for an event.

Event is invoked when the object has successfully connected to a datasource.

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

Return type:

None

Parameters:

cb (Any) –

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_reloaded(cb)

Adds a listener for an event.

Event is invoked when the object has been reloaded.

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

Return type:

None

Parameters:

cb (Any) –

add_event_reloading(cb)

Adds a listener for an event.

Event is invoked when the object is about to be reloaded.

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

Return type:

None

Parameters:

cb (Any) –

add_event_unloaded(cb)

Adds a listener for an event.

Event is invoked after the object has disconnected from a datasource.

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

Return type:

None

Parameters:

cb (Any) –

add_event_unloading(cb)

Adds a listener for an event.

Event is invoked when the object is about to be unloaded.

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

Return type:

None

Parameters:

cb (Any) –

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

add_load_listener(listener)

Adds a listener to be notified when the data is loaded.

Return type:

None

Parameters:

listener (com.sun.star.form.XLoadListener) –

add_property(name, attributes, value)

Adds a property to the container.

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

  • attributes (PropertyAttributeEnum) – The attributes of the property. Flags enum, this is a combination of com.sun.star.beans.PropertyAttribute.

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

Return type:

None

add_property_change_listener(name, listener)

Adds a listener for property changes.

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

  • listener (Any) – The listener to be added.

Return type:

None

add_reset_listener(listener)

Adds a listener to be notified when the form is reset.

Parameters:

listener (XResetListener) – Listener to be added.

Return type:

None

add_script_listener(listener)

Adds an XScriptListener that will be notified when an event takes place.

Parameters:

listener (XScriptListener) – The listener to be added.

Return type:

None

add_vetoable_change_listener(name, listener)

Adds a listener for vetoable changes.

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

  • listener (Any) – The listener to be added.

Return type:

None

attach(idx, obj, helper)

Attaches all the ScriptEvents which are registered for the given index to the given object.

Return type:

None

Parameters:
  • idx (int) –

  • obj (com.sun.star.uno.XInterface) –

  • helper (Any) –

bind_form_to_sql(src_name, cmd)

Bind the form to the database in the src_name URL, and send a SQL cmd

Parameters:
  • src_name (str) – Source Name URL

  • cmd (str) – Command

Return type:

None

bind_form_to_table(src_name, tbl_name)

Bind the form to the database in the src_name URL

Parameters:
  • src_name (str) – Source Name URL

  • tbl_name (str) – Table Name

Return type:

None

cancel_row_updates()

Cancels the updates made to a row.

This method may be called after calling an updateXXX method(s) and before calling XResultSetUpdate.updateRow() to rollback the updates made to a row. If no updates have been made or updateRow has already been called, then this method has no effect.

Return type:

None

create_enumeration()

Creates an enumeration of the container’s elements.

Return type:

XEnumeration

create_result_set()

Returns a new ResultSet based on the object.

Returns:

The new result set.

Return type:

XResultSet

delete_row()

Deletes the current row from the result set and the underlying database.

Return type:

None

delete_rows(rows)

Deletes one or more rows identified by their bookmarks.

Parameters:

rows (Tuple[Any, ...]) – tuple of bookmarks identifying the rows.

Returns:

A tuple of update counts containing one element for each row. The array is ordered according to the order in which bookmarks were given.

Return type:

Tuple[int, …]

detach(idx, obj)

Detaches all the ScriptEvents which are registered for the given index from the given object.

Return type:

None

Parameters:
  • idx (int) –

  • obj (com.sun.star.uno.XInterface) –

dispose()

Disposes the component.

Return type:

None

find_shape_for_control(ctl)

Find the shape for a control.

Parameters:
Returns:

Shape for the control or None if not found.

Return type:

XShape | None

New in version 0.38.0.

get_by_index(idx)

Gets the element at the specified index.

Parameters:

idx (int) – The Zero-based index of the element.

Returns:

The element at the specified index.

Return type:

Any

get_by_name(name)

Gets the element with the specified name.

Parameters:

name (str) – The name of the element.

Returns:

The element with the specified name.

Return type:

Any

get_control(ctl_model)

Gets the control from the specified control model.

Parameters:

ctl_model (XControlModel) – Control Model

Raises:

Exception – If unable to get control

Returns:

Control

Return type:

XControl

get_control_index(ctl)

Get the index of the control within the form.

Parameters:

ctl (FormCtlBase, XControlModel) – Control object.

Returns:

Control Index within the form or -1 if not found.

Return type:

int

New in version 0.38.0.

get_control_model(ctl_name)

Gets Control Model by Name

Parameters:

ctl_name (str) – Name of control

Raises:

MissingNameError – If control not found

Returns:

Control Model if found; Otherwise, None

Return type:

XControlModel | None

get_control_models()

Returns the control models.

Returns:

The controls.

Return type:

tuple[XControlModel]

get_count()

Gets the number of elements contained in the container.

Returns:

The number of elements.

Return type:

int

get_element_names()

Gets the names of all elements contained in the container.

Returns:

The names of all elements.

Return type:

tuple[str, …]

get_element_type()

Gets the type of the elements contained in the container.

Returns:

The type of the elements. None means that it is a multi-type container and you cannot determine the exact types with this interface.

Return type:

Any

get_group(idx)

Gets the group for the specified index.

Parameters:

idx (int) – The group index.

Returns:

Results as a tuple of 3 elements. Element at index 1 is a tuple of XControlModel objects. Element 2 is a tuple of str objects. Element at index 2 is a str containing name. A tuple is returned even if the index is not found.

Return type:

tuple

Note

The API documentation shows a return value of void for getGroup(). This is incorrect for python. The return value is a tuple with 3 elements.

See the LibreOffice API documentation for getGroup() for more information.

get_group_by_name(name)

Gets the group for the specified name.

Parameters:

name (str) – The name.

Returns:

Results as a tuple of 2 elements. Element at index 1 is a tuple of XControlModel objects. A tuple is returned even if the index is not found.

Return type:

tuple

Note

The API documentation shows a return value of void for getGroupByName(). This is incorrect for python. The return value is a tuple with 2 elements.

See the LibreOffice API documentation for getGroupByName() for more information.

get_group_control()

Returns the group control.

Returns:

The group control.

Return type:

bool

get_group_count()

Returns the group count.

Returns:

The group count.

Return type:

int

get_index_by_name(name)

Gets the element index by name.

Parameters:

name (str) – The name of the element.

Returns:

The index of the element if found; Otherwise -1.

Return type:

int

get_name()

Returns the name of the object.

Return type:

str

get_parameters()

Returns the container of parameters.

Returns:

The parameters.

Return type:

XIndexAccess

get_parent()

Returns the parent of the object.

Return type:

XInterface

get_property_set_info()

Returns the property set info.

Returns:

The property set info.

Return type:

XPropertySetInfo

get_property_value(name)

Returns the value of a property.

Parameters:

name (str) – The name of the property.

Returns:

The value of the property.

Return type:

Any

get_property_values()

Gets of all property values within the object in a single call.

Returns:

The property values.

Return type:

tuple[PropertyValue, …]

get_script_events(idx)

Returns all the ScriptEvents which are registered for the given index.

Return type:

Tuple[ScriptEventDescriptor, ...]

Parameters:

idx (int) –

get_service_name()

Returns the service name of the object.

Returns:

The service name.

Return type:

str

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

has_by_name(name)

Checks if the container has an element with the specified name.

Parameters:

name (str) – The name of the element.

Returns:

True if the container has an element with the specified name, otherwise False.

Return type:

bool

has_elements()

Determines whether the container has elements.

Return type:

bool

insert_by_index(index, element)

Inserts the given element at the specified index.

To append an element, use the index last index +1.

Parameters:
  • index (int) – The Zero-based index at which the element should be inserted.

  • element (T) – The element to insert.

Raises:
  • IllegalArgumentExceptioncom.sun.star.lang.IllegalArgumentException

  • IndexOutOfBoundsExceptioncom.sun.star.lang.IndexOutOfBoundsException

  • WrappedTargetExceptioncom.sun.star.lang.WrappedTargetException

Return type:

None

insert_by_name(name, element)

Inserts the element with the specified name.

Parameters:
  • name (str) – The name of the element to be inserted.

  • element (T) – The new element.

Return type:

None

insert_control_button(*, x, y, width, height=6, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a button control.

By Default the button has tab stop and does focus on click.

Parameters:
  • doc (XComponent) – Component

  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int, UnitT, optional) – Button Width.

  • height (int, UnitT, optional) – Button Height. Defaults to 6 mm.

  • label (str, optional) – Button label (text).

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Button Control

Return type:

FormCtlButton

insert_control_check_box(*, x, y, width, height=6, label='', tri_state=True, state=TriStateKind.NOT_CHECKED, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a check box control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • label (str, optional) – Label (text) to assign to checkbox.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Checkbox Control

Return type:

FormCtlCheckBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TriStateKind can be imported from ooodev.utils.kind.tri_state_kind.

insert_control_combo_box(*, x, y, width, height=6, entries=None, max_text_len=0, drop_down=True, read_only=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a ComboBox control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • entries (Iterable[str], optional) – Combo box entries

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • max_text_len (int, optional) – Specifies the maximum character count, There’s no limitation, if set to 0. Defaults to 0.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

ComboBox Control

Return type:

FormCtlComboBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_currency_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a currency field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Currency Field Control

Return type:

FormCtlCurrencyField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_date_field(*, x, y, width, height=6, min_date=datetime.datetime(1900, 1, 1, 0, 0), max_date=datetime.datetime(2200, 12, 31, 0, 0), drop_down=True, date_format=DateFormatKind.SYSTEM_SHORT, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Date field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • date_value (datetime.datetime | None, optional) – Specifics control datetime. Defaults to None.

  • min_date (datetime.datetime, optional) – Specifics control min datetime. Defaults to datetime(1900, 1, 1, 0, 0, 0, 0).

  • max_date (datetime.datetime, optional) – Specifics control Min datetime. Defaults to datetime(2200, 12, 31, 0, 0, 0, 0).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • date_format (DateFormatKind, optional) – Date format. Defaults to DateFormatKind.SYSTEM_SHORT.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Date Field Control

Return type:

FormCtlDateField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • DateFormatKind can be imported from ooodev.utils.kind.date_format_kind.

insert_control_file(*, x, y, width, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a file control.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

File Control

Return type:

FormCtlFile

insert_control_formatted_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a currency field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Currency Field Control.

Return type:

FormCtlFormattedField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_grid(*, x, y, width, height, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Grid control.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT) – Height.

  • label (str, optional) – Grid label.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Grid Control

Return type:

FormCtlGrid

insert_control_group_box(*, x, y, width, height, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Groupbox control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int | UnitT) – Width

  • height (int, UnitT) – Height.

  • label (str, optional) – Groupbox label.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Groupbox Control

Return type:

FormCtlGroupBox

insert_control_hidden(*, name='', **kwargs)

Inserts a Hidden control into the form.

Parameters:
  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • kwargs (Any) –

Returns:

Hidden Control.

Return type:

FormCtlHidden

insert_control_image_button(*, x, y, width, height, image_url='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts an Image Button control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • image_url (PathOrStr, optional) – Image URL. When setting the value it can be a string or a Path object. If a string is passed it can be a URL or a path to a file. Value such as file:///path/to/image.png and /path/to/image.png are valid. Relative paths are supported.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Image Button Control.

Return type:

FormCtlImageButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_label(*, x, y, width, label, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Label control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • label (str) – Contents of label.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Label Control.

Return type:

FormCtlFixedText

insert_control_list_box(*, x, y, width, height, entries=None, drop_down=True, read_only=False, line_count=5, multi_select=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a ListBox control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • entries (Iterable[str], optional) – Combo box entries

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • line_count (int, optional) – Specifies the number of lines to display. Defaults to 5.

  • multi_select (int, optional) – Specifies if multiple entries can be selected. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

ListBox Control.

Return type:

FormCtlListBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_navigation_toolbar(*, x, y, width, height, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Navigation Toolbar control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Navigation Toolbar Control

Return type:

FormCtlNavigationToolBar

insert_control_numeric_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Numeric field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Numeric Field Control.

Return type:

FormCtlNumericField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_pattern_field(*, x, y, width, height=6, edit_mask='', literal_mask='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Pattern field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • edit_mask (str, optional) – Specifies a character code that determines what the user may enter. Defaults to "".

  • literal_mask (str, optional) – Specifies the initial values that are displayed in the pattern field. Defaults to "".

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Pattern Field Control.

Return type:

FormCtlPatternField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_radio_button(*, x, y, width, height=6, label='', state=StateKind.NOT_CHECKED, multiline=False, border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a radio button control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • label (str, optional) – Label (text) of control.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • state (StateKind, optional) – Specifies the state of the control.Defaults to StateKind.NOT_CHECKED.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Radio Button Control.

Return type:

FormCtlRadioButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • StateKind can be imported from ooodev.utils.kind.state_kind.

insert_control_rich_text(*, x, y, width, height, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Rich Text control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Rich Text Control.

Return type:

FormCtlRichText

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_scroll_bar(*, x, y, width, height=6, min_value=0, max_value=100, orientation=OrientationKind.HORIZONTAL, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Scrollbar control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to 0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 100.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Scrollbar Control.

Return type:

FormCtlScrollBar

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • OrientationKind can be imported from ooodev.utils.kind.orientation_kind.

insert_control_spin_button(*, x, y, width, height=6, value=0, min_value=-1000000, max_value=1000000, increment=1, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Spin Button control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • value (int, optional) – Specifies the initial value of the control. Defaults to 0.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Spin Button Control.

Return type:

FormCtlSpinButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_submit_button(*, x, y, width, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a submit button control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Submit Button Control.

Return type:

FormCtlSubmitButton

insert_control_text_field(*, x, y, width, height, text='', echo_char='', border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Text field control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • text (str, optional) – Text value.

  • echo_char (str, optional) – Character used for masking. Must be a single character.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Text Field Control.

Return type:

FormCtlTextField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_control_time_field(*, x, y, width, height=6, time_value=None, min_time=datetime.time(0, 0), max_time=datetime.time(23, 59, 59, 999999), time_format=TimeFormatKind.SHORT_24H, spin_button=True, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Time field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • time_value (datetime.time | None, optional) – Specifics the control time. Defaults to None.

  • min_time (datetime.time, optional) – Specifics control min time. Defaults to time(0, 0, 0, 0).

  • max_time (datetime.time, optional) – Specifics control min time. Defaults to a time(23, 59, 59, 999_999).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • time_format (TimeFormatKind, optional) – Date format. Defaults to TimeFormatKind.SHORT_24H.

  • pin_button (bool, optional) – When True, a spin button is present. Defaults to True.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • spin_button (bool) –

Returns:

Time Field Control.

Return type:

FormCtlTimeField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TimeFormatKind can be imported from ooodev.utils.kind.time_format_kind.

insert_db_control_check_box(*, x, y, width, height=6, tri_state=True, state=TriStateKind.CHECKED, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a database check box control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Checkbox Control.

Return type:

FormCtlDbCheckBox

insert_db_control_combo_box(*, x, y, width, height=6, entries=None, max_text_len=0, drop_down=True, read_only=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database ComboBox control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • entries (Iterable[str], optional) – Combo box entries

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • max_text_len (int, optional) – Specifies the maximum character count, There’s no limitation, if set to 0. Defaults to 0.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database ComboBox Control.

Return type:

FormCtlDbComboBox

insert_db_control_currency_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a database currency field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Currency Field Control.

Return type:

FormCtlDbCurrencyField

insert_db_control_date_field(*, x, y, width, height=6, min_date=datetime.datetime(1900, 1, 1, 0, 0), max_date=datetime.datetime(2200, 12, 31, 0, 0), drop_down=True, date_format=DateFormatKind.SYSTEM_SHORT, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database Date field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • date_value (datetime.datetime | None, optional) – Specifics control datetime. Defaults to None.

  • min_date (datetime.datetime, optional) – Specifics control min datetime. Defaults to datetime(1900, 1, 1, 0, 0, 0, 0).

  • max_date (datetime.datetime, optional) – Specifics control Min datetime. Defaults to datetime(2200, 12, 31, 0, 0, 0, 0).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • date_format (DateFormatKind, optional) – Date format. Defaults to DateFormatKind.SYSTEM_SHORT.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Date Field Control.

Return type:

FormCtlDbDateField

insert_db_control_formatted_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database currency field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Currency Field Control.

Return type:

FormCtlDbFormattedField

insert_db_control_list_box(*, x, y, width, height, entries=None, drop_down=True, read_only=False, line_count=5, multi_select=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database ListBox control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • entries (Iterable[str], optional) – Combo box entries

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • line_count (int, optional) – Specifies the number of lines to display. Defaults to 5.

  • multi_select (int, optional) – Specifies if multiple entries can be selected. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database ListBox Control.

Return type:

FormCtlDbListBox

insert_db_control_numeric_field(*, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database Numeric field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Numeric Field Control.

Return type:

FormCtlDbNumericField

insert_db_control_pattern_field(*, x, y, width, height=6, edit_mask='', literal_mask='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database Pattern field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • edit_mask (str, optional) – Specifies a character code that determines what the user may enter. Defaults to "".

  • literal_mask (str, optional) – Specifies the initial values that are displayed in the pattern field. Defaults to "".

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Pattern Field Control.

Return type:

FormCtlDbPatternField

insert_db_control_radio_button(*, x, y, width, height=6, state=StateKind.NOT_CHECKED, multiline=False, border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database radio button control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • tri_state (StateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to StateKind.NOT_CHECKED.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Radio Button Control.

Return type:

FormCtlDbRadioButton

insert_db_control_text_field(*, x, y, width, height, text='', echo_char='', border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database Text field control.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • text (str, optional) – Text value.

  • echo_char (str, optional) – Character used for masking. Must be a single character.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

Returns:

Database Text Field Control.

Return type:

FormCtlDbTextField

insert_db_control_time_field(*, x, y, width, height=6, time_value=None, min_time=datetime.time(0, 0), max_time=datetime.time(23, 59, 59, 999999), time_format=TimeFormatKind.SHORT_24H, spin_button=True, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', styles=None)

Inserts a Database Time field control into the form.

Parameters:
  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • time_value (datetime.time | None, optional) – Specifics the control time. Defaults to None.

  • min_time (datetime.time, optional) – Specifics control min time. Defaults to time(0, 0, 0, 0).

  • max_time (datetime.time, optional) – Specifics control min time. Defaults to a time(23, 59, 59, 999_999).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • time_format (TimeFormatKind, optional) – Date format. Defaults to TimeFormatKind.SHORT_24H.

  • pin_button (bool, optional) – When True, a spin button is present. Defaults to True.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • spin_button (bool) –

Returns:

Database Time Field Control.

Return type:

FormCtlTimeField

insert_entry(idx)

Inserts a new entry into the event attacher manager.

Return type:

None

Parameters:

idx (int) –

insert_row()

Inserts a new row into the result set and the underlying database.

Must be on the insert row when this method is called.

Return type:

None

is_loaded()

Returns whether the data is loaded.

Return type:

bool

load()

Loads the data.

Return type:

None

move_to_current_row()

Moves the cursor to the remembered cursor position, usually the current row.

This method has no effect if the cursor is not on the insert row.

Return type:

None

move_to_insert_row()

Moves the cursor to the insert row.

The current row is remembered while the cursor is positioned on the insert row.

Return type:

None

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.

read(stream)

Reads the object from the given stream.

Parameters:

stream (XObjectInputStream) – The stream to read from.

Return type:

None

register_script_event(idx, event)

Registers a ScriptEvent for the given index.

Return type:

None

Parameters:
  • idx (int) –

  • event (com.sun.star.script.ScriptEventDescriptor) –

register_script_events(idx, events)

Registers a ScriptEvent for the given index.

Return type:

None

Parameters:
  • idx (int) –

  • events (Tuple[com.sun.star.script.ScriptEventDescriptor, ...]) –

reload()

Does a smart refresh of the object.

Return type:

None

remove_by_index(index)

Removes the element at the specified index.

Parameters:

index (int) – The Zero-based index of the element to remove.

Raises:
  • IndexOutOfBoundsExceptioncom.sun.star.lang.IndexOutOfBoundsException

  • WrappedTargetExceptioncom.sun.star.lang.WrappedTargetException

Return type:

None

remove_by_name(name)

Removes the element with the specified name.

Parameters:

name (str) – The name of the element to be removed.

Return type:

None

remove_entry(idx)

Removes the entry at the given position.

Return type:

None

Parameters:

idx (int) –

remove_event_container_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_element_inserted(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_element_removed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_element_replaced(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_listener(listener)

Removes an event listener from the component.

Parameters:

listener (XEventListener) – The event listener to be removed.

Return type:

None

remove_event_load_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_loaded(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_reloaded(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_reloading(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_unloaded(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_unloading(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_load_listener(listener)

Removes a listener from the list of load listeners.

Return type:

None

Parameters:

listener (com.sun.star.form.XLoadListener) –

remove_property(name)

Removes a property from the container.

Parameters:

name (str) – The name of the property.

Return type:

None

remove_property_change_listener(name, listener)

Removes a listener for property changes.

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

  • listener (Any) – The listener to be removed.

Return type:

None

remove_reset_listener(listener)

Removes a listener from the list of listeners that are notified when the form is reset.

Parameters:

listener (XResetListener) – Listener to be removed.

Return type:

None

remove_script_listener(listener)

Removes an XScriptListener that was added with addScriptListener.

Return type:

None

Parameters:

listener (com.sun.star.script.XScriptListener) –

remove_vetoable_change_listener(name, listener)

Removes a listener for vetoable changes.

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

  • listener (Any) – The listener to be removed.

Return type:

None

replace_by_index(index, element)

Replaces the element at the specified index with the given element.

Parameters:
  • index (int) – The index of the element that is to be replaced.

  • element (Any) – The replacement element.

Return type:

None

replace_by_name(name, element)

Replaces the element with the specified name.

Parameters:
  • name (str) – The name of the element to be replaced.

  • element (T) – The new element.

Return type:

None

reset()

Resets a component to some default value.

Return type:

None

revoke_script_event(idx, listen_type, event_method, remove_listener_param)

Revokes the registration of an event.

The parameters listen_type and event_method are equivalent to the first two members of the ScriptEventDescriptor used to register events.

Return type:

None

Parameters:
  • idx (int) –

  • listen_type (str) –

  • event_method (str) –

  • remove_listener_param (str) –

revoke_script_events(idx)

Revokes all events which are registered for the given index.

If the events at this index have been attached to any object, they are detached automatically.

Return type:

None

Parameters:

idx (int) –

set_control_models(controls)

Sets the control models.

Parameters:

controls (tuple[XControlModel]) – The controls.

set_group(group, name)

Sets the group.

Parameters:
  • group (int) – The group.

  • name (str) – The name.

set_name(name)

Sets the name of the object.

Return type:

None

Parameters:

name (str) –

set_parent(parent)

Sets the parent of the object.

Return type:

None

Parameters:

parent (com.sun.star.uno.XInterface) –

set_property_value(name, value)

Sets the value of a property.

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

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

Return type:

None

set_property_values(values)

Sets of all property values within the object in a single call.

All properties which are not contained in the sequence values will be left unchanged.

Parameters:

values (tuple[PropertyValue, ...]) – The property values.

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

unload()

Unloads the data.

Return type:

None

update_row()

Updates the underlying database with the new contents of the current row.

This method cannot be called when the cursor is on the insert row.

Return type:

None

write(stream)

Writes the object to the given stream.

Parameters:

stream (XObjectOutputStream) – The stream to write to.

Return type:

None

property component: com.sun.star.form.component.DataForm

DataForm Component

Return type:

DataForm

property events_listener_container: ContainerListener

Returns listener

Return type:

ContainerListener

property events_listener_event: EventListener

Returns listener

Return type:

EventListener

property events_listener_load: LoadListener

Returns listener

Return type:

LoadListener

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:

TheDict

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property name: str

Gets/Sets the name of the form.

Return type:

str

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property owner: DrawForms

Component Owner

Return type:

DrawForms