Skip to content
kelsa-pi edited this page Jun 17, 2018 · 24 revisions
  • Start LibreOffice from the command line

    soffice "--accept=socket,host=localhost,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext" --norestore

    /opt/libreofficedev5.4/program/soffice "--accept=socket,host=localhost,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext" --norestore

  • Open your macro file in editor

    Create your macro file, or copy template simple_macro.py to LIBREOFFICE_PATH/4/user/Scripts/python directory.

    Name your context variable ctx(see simple_macro.py for example)

  • Set breakpoints in the source code

    Left click in the very small column just after the line number's column.

    Set breakpoints

    Please note, in order to show property or method in workspace or shell use the debug toolbar buttons to move to the next line/breakpoint. Debug toolbar

  • Run source code in the editor

    Menu Run -> Run file as script

  • Debugging

    Use the debug toolbar buttons to move in the editor to the next line/breakpoint.

    Double clik on property or method in workspace to drill down.

    More information about debugging with Pyzo you can find here

  • Examine property or method

    In PyUNO_Workspace:

    • one clik on property or method to show API reference
    • double clik on property or method to drill down or
    • find more information with right clik on property or method.

    Drill

  • Examine variable value in shell

    Variable

  • Set arguments

    • Write argument in Arguments text box and double click on appropriate method.

      Examples:

      • "Standard" = object.getByName("Standard")
      • 0 = object.getByIndex(0)
      • [space] = object.getMethod( )

      Argument

    • Select Index or Name from dropdown box

      Argument

  • Insert code in editor

    Pres icon to insert code at cursor position

    Insert code

    Inserted code in the script

    initial_target = document.BasicLibraries
    item = initial_target.getByName("Standard")
    
Clone this wiki locally