Skip to content

Embed dialog in ODF document

sasa edited this page Apr 14, 2017 · 9 revisions

Convert dialog file .xdlto python code and embed in LibreOffice document

Usage

  • Prepare

    • create dialog in Dialog Editor
    • create project directory in LIBREOFFICE_PATH/4/user/Scripts/python/
    • place ODF document eg. Text document.odt in project dir.(tested with .odt, .ods, .odp and .odg).
    • copy config.ini in project directory and edit section to customize behavior (optional)
  • Write code

    • run unodit with parameter embed_convert

      use parameter -f to set the path to any local directory with xdl file.

        python3 ./unodit.py -m 'embed_convert'
                            -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                            -f 'LIBREOFFICE_PATH/4/user/basic/DialogLib/Default.xdl'
                            -a 'Test_embed'
      
    • write your code in generated file Test_embed.py

  • Pack macro in document

    • run unodit with parameter embed_pack

        python3 ./unodit.py -m 'embed_convert'
                            -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                            -f 'LIBREOFFICE_PATH/4/user/basic/DialogLib/Default.xdl'
                            -a 'Test_embed'
      

Available options for parameter -m: 'embed_convert', 'embed_pack', 'embed_all' 'embed_all' = all in one, use for testing

Directory structure and parameters

TestLib/
        Text document.odt
        src/                          embed_convert
            Test_embed.py            --------------
        Text document_MACRO.odt       embed_pack
Clone this wiki locally