How to read the LibreOffice API

Hello everyone,

I am having a really hard time understanding the “com.sun.star…” interface. This is really awkward for beginners like me and even reading through Pitonyak s manual its for me not clear of how to make sense of this:

https://api.libreoffice.org/docs/idl/ref/namespaces.html

For example setting up a sort descriptor I would never be able to do with the help of just this website. I have done it in the end but with a lot of help from the community here…

'array of c.s.s.beans.PropertyValue
aSortDescriptor(0).Name = “ContainsHeader”
aSortDescriptor(0).Value = hasheader
aSortDescriptor(1).Name = “SortFields”
aSortDescriptor(1).Value = sFields
aSortDescriptor(2).Name = “SortColumns”
aSortDescriptor(2).Value = false
oRange.sort(aSortDescriptor()).

→ and even here I feel I am missing out on a new function like:
createSortDescriptor()

Is there any good manual of how to read this interface somewhere? Did I miss it in Pitonyaks manual (700 or so pages?)

And also: why the heck is this so confusing in comparison to vba in excel? com.sun.start.?!

Thanks a lot in advance.
Cheers

“…there’s way too much information to decode the Matrix. You get used to it, though. Your brain does the translating. I don’t even see the code…” :slightly_smiling_face:

  1. Search this site for “resources”

  2. Pitonyak, which you have done.

  3. MRI 1.3.4: Releases · hanya/MRI · GitHub

  4. MRI really doesn’t address your exact question. What it addresses is letting you see clearly everything leading up to your question–it addresses the “I feel I am missing out…” part.

  5. 4: Deciphering the Official Documents of LibreOffice or OpenOffice|T.B.P.. (Oddly, written as a Socratic dialogue)

  6. Note that the sort method you refer to is a bit of a rarity. If you avoid using DispatchHelper (as I’m sure you know to), you really don’t pack beans properties very often.

Hello,
In addition are the developer guides:

LibreOffice Developer’s Guide
.
Apache OpenOffice Developer’s Guide

com.sun.star is one of the cumbersome paths. The legacy of the past. You have to accept it and get used to it.

Global css As Object
Sub InitGlobals()
	css = com.sun.star
	Print TypeName(css.sheet.CellFlags.STRING)
End Sub

And then use <css>.

P.S. You will still need the SortDescriptor when you want to use custom sort lists.
UserListEnabled
UserListIndex
And when you need to sort by more than 3 columns.

1 Like