Código: Seleccionar todo
sub ORDENAR
rem define variables
dim document as object
dim dispatcher as object
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Nr"
args1(0).Value = 5
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$A$1:$J$336"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Nr"
args4(0).Value = 3
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args4())
dim args5(5) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Flags"
args5(0).Value = "SVDNT"
args5(1).Name = "FormulaCommand"
args5(1).Value = 0
args5(2).Name = "SkipEmptyCells"
args5(2).Value = false
args5(3).Name = "Transpose"
args5(3).Value = false
args5(4).Name = "AsLink"
args5(4).Value = false
args5(5).Name = "MoveMode"
args5(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args5())
dim args6(8) as new com.sun.star.beans.PropertyValue
args6(0).Name = "ByRows"
args6(0).Value = true
args6(1).Name = "HasHeader"
args6(1).Value = false
args6(2).Name = "CaseSensitive"
args6(2).Value = false
args6(3).Name = "IncludeAttribs"
args6(3).Value = true
args6(4).Name = "UserDefIndex"
args6(4).Value = 5
args6(5).Name = "Col1"
args6(5).Value = 10
args6(6).Name = "Ascending1"
args6(6).Value = true
args6(7).Name = "Col2"
args6(7).Value = 9
args6(8).Name = "Ascending2"
args6(8).Value = true
dispatcher.executeDispatch(document, ".uno:DataSort", "", 0, args6())
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Nr"
args7(0).Value = 1
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args7())
end sub