Hallo Mathias,

the example works perfectly. Thanks.

I wish your entire group a very Happy New Year 2008.

Greetings,

Rudi


----- Original Message ----- From: "Mathias Röllig" <[EMAIL PROTECTED]>
To: <dev@api.openoffice.org>
Sent: Tuesday, November 20, 2007 5:42 PM
Subject: Re: [api-dev] Sort problem


Hello Hubert!

Where did you find this example?

Am 19.11.2007 21:09 schrieb Rudolf Huber:

Option Explicit

Sub Sorttest()
    Dim oSheetDSC,oDSCRange As Object

'If you want to create typed variables you must
'declare the type of each variable:

Dim oSheetDSC As Object, oDSCRange As Object


    Dim aSortFields(0) As New com.sun.star.util.SortField
    Dim aSortDesc(0) As New com.sun.star.beans.PropertyValue

'What is "oTabellenListe"? I think:

Dim oDoc As Object
Dim oTabellenListe As Object
oDoc = ThisComponent          'or your document
oTabellenListe = oDoc.Sheets

    oSheetDSC = oTabellenListe.getByIndex("Tabelle2")

'This is the same as
' oSheetDSC = oTabellenListe.getByIndex( 0 )

'Whether you use
' oSheetDSC = oTabellenListe.getByIndex( 1 )
'or
oSheetDSC = oTabellenListe.getByName( "Tabelle2" )


    oDSCRange = oSheetDSC.getCellRangeByName("A1:Z2000")

    rem ThisComponent.getCurrentController.select(oDSCRange)
    rem getCurrentController.select(oDSCRange)

'You don't need the CurrentController here.


    aSortFields(0).Field = 1

'Should it be the second column (B)?


    aSortFields(0).SortAscending = TRUE
    aSortDesc(0).Name = "SortFields"
    aSortDesc(0).Value = aSortFields()
    oDSCRange.Sort(aSortDesc())
End Sub



Greetings
Mathias
--
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·->8·-·

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to