O'Reilly logo

Programmation OpenOffice.org et LibreOffice by Laurent Godard, Bernard Marcelly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Trier une zone

Un objet zone de cellules fournit une méthode de tri (en anglais Sort). Nous allons effectuer un tri sur la première colonne du tableau de la feuille Compositeurs. Voici l’ensemble du code, que nous expliquerons progressivement.

rem Code09-03.ods bibli : Calculs Module2

Option Explicit

Sub Trier1Colonne()

Dim monDocument As Object, lesFeuilles As Object

Dim maFeuille As Object, maZone As Object

Dim ConfigTri(0) As New com.sun.star.table.TableSortField

Dim DescrTri As Variant

monDocument = ThisComponent

lesFeuilles = monDocument.Sheets

maFeuille = lesFeuilles.getByName(“Compositeurs”)

maZone = maFeuille.getCellRangeByName(“A1:D118”)

With ConfigTri(0)

.Field = 0 ‘ colonne A = “Nom, Prénom”

.IsAscending = true

End With

DescrTri ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required