How to get the feature `Enable natural sort` with a SortDescriptor for sorting a SheetCellRange

Enable natural sort is offered by the respective dialog and it seems to work with recorded macros. On the other hand there is no obvious way to get the needed collation when sorting API-based using a SortDescriptor.

I would like to know a probably existing “not quite obvious way”.

Possibly TextSortDescriptor’s IsSortNumericN attributes are relevant? (I didn’t check the code, sorry)

Sorry. I couldn’t figure out how to try this.
The type setting Numeric per field has no effect insofar (as judged from my experiments).

Hallo
Implement the “natural Sort” -function by yourself, for Example how it is done in the Sort AddInn thread
the final Version so far:
XPySort.ods change …ods to …oxt (4.7 KB)

Thanks.

To get (or to write myself) a collator for natural sort not accessible via the API wasn’t my intention.
I definitely wanted to get the advantages of the very efficient sorting implemented in LibO, of its readiness to include the collation of many fields in the needed order (seemingly in one go), and of the related application of locales.

As so often: I don’t urgently need the answer. I mainly want to know.
In addition I remind of my opinion that every feature available via the UI (and sometimes based on UI usage even via recorded macros) should be implemented in a way making it also accessible by calls to API methods. In fact LibO should work as if it actually does everything by API calls itself.

1 Like