1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| sub Vincent ()
dim document as object
dim dispatcher as object
dim feuile as object
dim args1(0) as new com.sun.star.beans.PropertyValue
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Feuille = ThisComponent.getCurrentController().getActiveSheet()
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args1())
CelluleActive = ThisComponent.getCurrentSelection
NbCol = CelluleActive.CellAddress.Column + 1
NbLig = CelluleActive.CellAddress.Row + 1
'Teste les lignes vides
for i = NbLig to 0 step -1
Cell = Feuille.getCellByPosition(0, i)
ThisComponent.currentController.select(Cell)
select case Cell.type
Case com.sun.star.table.CellContentType.EMPTY
ThisComponent.currentController.select(Cell)
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
end select
next
'Teste les colonnes vides
for i = NbCol to 0 step -1
Cell = Feuille.getCellByPosition(i, 0)
ThisComponent.currentController.select(Cell)
select case Cell.type
Case com.sun.star.table.CellContentType.EMPTY
ThisComponent.currentController.select(Cell)
dispatcher.executeDispatch(document, ".uno:DeleteColumns", "", 0, Array())
end select
next
end sub |
Partager