It's easy via interface, but I need via macro.
I tried this macro, but it works just to three fiels.
Code: Select all
Sub ordenaDados(oDoc As object, oPlan As Object, Ci%, Li%, OrdemCol1, OrdemCol2, OrdemCol3, OrdemCol4)
Dim Despachante As Object, Controle As Object
Despachante = createUnoService("com.sun.star.frame.DispatchHelper")
Controle = oDoc.CurrentController
Controle.Select( oPlan.GetCellByPosition(Ci,Li) )
Dim args(13) As New com.sun.star.beans.PropertyValue
args(0).Name = "ByRows"
args(0).Value = True
args(1).Name = "HasHeader"
args(1).Value = False
args(2).Name = "CaseSensitive"
args(2).Value = False
args(3).Name = "NaturalSort"
args(3).Value = False
args(4).Name = "IncludeAttribs"
args(4).Value = True
args(5).Name = "UserDefIndex"
args(5).Value = 0
args(6).Name = "Col1"
args(6).Value = OrdemCol1
args(7).Name = "Ascending1"
args(7).Value = True
args(8).Name = "Col2"
args(8).Value = OrdemCol2
args(9).Name = "Ascending2"
args(9).Value = True
args(10).Name = "Col3"
args(10).Value = OrdemCol3
args(11).Name = "Ascending3"
args(11).Value = True
args(12).Name = "Col4"
args(12).Value = OrdemCol4
args(13).Name = "Ascending4"
args(13).Value = True
Despachante.executeDispatch(Controle, ".uno:DataSort", "", 0, args())
End Sub