API/Samples
UNO allows the usage of the LibreOffice API from different programming languages, and it is often very useful to find some short examples showing different API use cases for different programming languages. Under this section in the wiki you can find examples of such API use case for the different supported programming languages.
Samples
- API/Samples/Java
- API/Samples/Cpp
- API/Samples/StarBasic
- API/Samples/Python
- API/Samples/Groovy
- API/Samples/Any_Language
Where to get the sourcecode?
You can find some examples described above (and additional stuff) in the LibreOffice Subversion repository. The directory structure below /contrib/sdk is similar to the one in the wiki:
- /contrib/sdk/examples/java contains - as you might expect - Java examples
Checkout the sourcecode
You need a working Subversion client to check out the source from the repository. On Unix you can use the following command to retrieve all Java examples:
svn export svn://svn.services.openoffice.org/ooo/contrib/sdk/examples/java java-examples
On Windows you can use a graphical client, e.g. TortoiseSVN.
Guideline
This example section follows some rules that should be taken into account when somebody wants to contribute to these example collection. The examples for the different languages are collected dynamically and that is one reason why contributors should follow these rules.
- select the right programming language and the appropriate sub category (e.g. Writer, Calc, ....)
- save your example in a hierarchical structure, e.g API/Samples/Java/Office/MyExample
- use always the category API and Samples and additionally the category for your language ad sub category. In the example above it is Java and Office
The hierarchical structure can be extended on demand to group examples in a further category!