1 # Document Handling Examples
3 These examples are somehow similar to DocumentLoader in C++ and Java.
4 To get started, first start LibreOffice listening on port 2083
6 $OFFICE_PROGRAM_PATH/soffice "--accept=socket,port=2083;urp;"
8 Each example script accepts `-h` to show the usage, e.g.
10 $OFFICE_PROGRAM_PATH/python DocumentLoader.py -h
12 You should use `setsdkenv_unix` for Unix/Linux and `setsdkenv_windows.bat` for
13 Windows. In this way, the LibreOffice internal Python interpreter will be used.
18 $OFFICE_PROGRAM_PATH/python DocumentConverter.py ./tests/ "MS Word 97" doc /tmp/
21 This command searches LibreOffice documents recursively under directory
22 `./tests` and convert every found document to format Microsoft Word 97. The
23 converted document can be found under directory `/tmp`.
28 $OFFICE_PROGRAM_PATH/python DocumentLoader.py ./tests/hello.odt
31 This command opens document `./tests/hello.odt` in a separate window.
33 This script also accepts option to open an empty document. For example, to open
34 an empty spreadsheet document:
37 $OFFICE_PROGRAM_PATH/python DocumentLoader.py --calc
43 $OFFICE_PROGRAM_PATH/python DocumentPrinter.py myprinter ./tests/hello.odt "1-3"
46 This command prints the first three pages of document `./tests/hello.odt` on
47 printer `myprinter `. You can also specify the page range in various format,
53 $OFFICE_PROGRAM_PATH/python DocumentSaver.py path/to/hello.doc path/to/hello.odt
56 This command saves a Word document `hello.doc` as an OpenDocument file `hello.odt`.