Macros/Writer/004

Description
This macro sorts a table column in LibreOffice Writer alphabetically, for the column which contains the cursor.

The program contains four subroutines which:
 * Sort a column alphabetically ascending
 * Sort a column alphabetically ascending, excluding the header row
 * Sort a column alphabetically descending
 * Sort a column alphabetically descending, excluding the header row

This macro also exists in an equivalent form as an extension, by clicking this link for download of sortwritertable-1.0.0.oxt. Upon download, the extension adds a new toolbar with 4 buttons, which are linked to the four macros.

Code
In LibreOffice Basic:

ODT file to test macro

 * [[Media:Example macro for sorting tables.odt|Download example ODT file with this macro included]]