C++ application development for API LibreOffice (CppToolBoxLibreOffice)

I've developped an external software in C++ with LibreOffice API / SDK (for Calc).

And it was not really easy... So if it can help other people interested, I have put here an interesting example with some easy functions that can be used

(to set text, justify, colors, ... in the cell(s). set rows/columns... select/add sheet... add chart, shapes, images,... select print area...)

See sources, or just binary executable (Windows) for a test.... (see below after snapshots)

Perhaps it works also with OpenOffice, but not tested...

Else, I recommends you to start using the easier C++ SimpleBootstrap example in "examples\DevelopersGuide\ProfUNO\SimpleBootstrap_cpp"

instead of the C++ DocumentLoader in "examples\cpp\DocumentLoader" requiring you have previously launched a soffice listening on server port...

And then modify SimpleBootstrap to load a document instead of starting with blank document...

I've used Visual C++ 2008 Express Edition as explained on API LibreOffice Installation Guide when using Windows...

I was surprised that Visual C++ lacks the classic dirent interface, see here this usefull dirent clone interface: http://softagalleria.net/dirent.php

In august 2016, I used Visual C++ Build Tools 2015 in place for the Windows compiler. See Install LibreOffice-SDK for cpp if needed...

In june 2017, I've reupdated this demo project (added new functions "new page" start, and get height/width, for row & col).

Links :

http://api.libreoffice.org/

http://api.libreoffice.org/docs/idl/ref/

https://www.openoffice.org/api/docs/common/ref/com/sun/star/module-ix.html

https://wiki.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK

https://wiki.openoffice.org/wiki/Calc/API/Programming

https://wiki.openoffice.org/wiki/SDKCppLanguage

http://moutou.pagesperso-orange.fr/MyUNODoc_HTML/UNOCppAPI.html

http://www.linuxjournal.com/article/8608

Screenshots of the demo "CalcDocumentHandling"

To test the Windows demo executable :

Extract the zip archive CalcDocumentHandlingExe.zip,

and then in the console,

go with "cd" in the directory where you extracted the archive,

then run it with "CalcDocumentHandling.exe demo.ods"

or "CalcDocumentHandling.exe demo.ods maidis_Horizontal_Striped_Hot_Air_Balloons.png" to load the nice ballon image !

To recompile the demo :

First create a directory "CalcDocumentHandlingDemo" in "examples/cpp" of the LibreOffice SDK, and then download and copy all the files below (except ".zip" ones)...

Then see sub page here how to compile a cpp project : Install LibreOffice-SDK for cppÂ