Class DispatchContext

class ooodev.utils.context.DispatchContext(cmd, inst=None, **kwargs)[source]

Context manager for toggling the dispatch command. This manager sends the command to the LibreOffice instance on enter and exit.

The dispatch command is used to send commands to the LibreOffice instance.

Example

with DispatchContext("SwitchControlDesignMode"):
    ctl = cell.control.insert_control_currency_field(
        min_value=0, spin_button=True
    )
    ctl.model.Repeat = True
    ctl.value = cell.get_num()

New in version 0.38.1.

Parameters:
  • cmd (str) –

  • inst (LoInst | None) –

  • kwargs (Any) –

__init__(cmd, inst=None, **kwargs)[source]

Constructor for LoContext

Parameters:
  • cmd (str) – The command to send to the LibreOffice instance.

  • inst (LoInst, optional) – The instance of that is used to send dispatch. This is generally used when working with multiple instances of LibreOffice.

  • kwargs (Any, optional) – Any additional arguments to send with the command.

Return type:

None