2

I need to edit LibreOffice Calc document programmatically in C++. I know that there is odfkit library, which uses webodf, but it looks like it doesn't support editing .ods files.

Is there any alternative that can deliver me this feature?

Krzysztof Stanisławek
  • 1,267
  • 4
  • 13
  • 27

2 Answers2

3

Libreoffice has API, called UNO, for controlling it from another process. So if you need something more complicated, that would be the simplest route.

If you just need some simple transformation, the other option is to unpack the file with plain old zip library (libzip, libarchive, ...) and modify the XML manually.

The opendocument site also mentions lpOD, but the web seems defunct and while search comes up with something that looks relevant, I am not sure whether there is anything usable.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
  • I need to access values of specific cells, that's all. – Krzysztof Stanisławek May 29 '14 at 18:04
  • 1
    @KrzysztofStanisławek: If you just need to read values from fixed positions or positions identified by some title, reading the `content.xml` directly with XML parser should not be hard and will save you some resources. If you need to recalculate formulas or such, you are probably best off with the openoffice api. I believe the results of formulas are precalculated and stored in the file, so you can read them from the XML directly, but I am not sure about this. – Jan Hudec May 29 '14 at 19:21
  • @KrzysztofStanisławek: While checking the facts I also ran across lpOD; I am not sure how complete it is. – Jan Hudec May 29 '14 at 19:26
1

see the SDK documentation, with many examples

ngulam
  • 995
  • 1
  • 6
  • 11