using libreoffice calc software as a library

Thorsten Behrens thb at libreoffice.org
Thu Feb 9 20:22:41 UTC 2017


Detlef Hüttemann wrote:
> Is the only way to do it the -headless approach? Or can I use some
> software components as a library in my own application?
> 
Hi Detlef,

so perhaps the LibreOfficeKit approach would suit your usecase - it's
a reasonably smallish C/C++ API around a fully headless LibreOffice,
currently used in some document viewers, and also for LibreOffice
Online.

It already provides functions to initialize, load, and process
documents - adding another callback under the LOK_USE_UNSTABLE_API
section in include/LibreOfficeKit/LibreOfficeKit.hxx shouldn't be too
hard, see e.g. commit 1a74c6333a79ccf0579b33ebc42ce2ccc23ccadb for a
smallish example of how to get something out of the LibreOffice core.

Example code how to retrieve a cell's value:

in sc/qa/unit/functions_test.cxx, the FunctionsTest::load() -

* DoHardRecalc()
* GetDocument().GetValue(col,row,sheet,out_val)

For something enterprise-ready, you'd probably want to run LibreOffice
in a separate process or something, to keep it at arm's length from
your webserver & php interpreter.

HTH,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: Digital signature
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170209/9cd0278b/attachment.sig>


More information about the LibreOffice mailing list