von Stephan » Do, 21.04.2016 06:53
Schwebt mir vor, ist aber wohl ein Traumwunsch?
Nein, im Normalfall nicht. Ob im Detail genau das umzusetzen ist was Du haben willst hängt natürlich von den Anforderungen ab.
Im Anhang ein Beispiel das nur auf Tastendruck einige Werte kopiert und löscht und eine Zelle in den Edit-Modus versetzt.
Hinweis:
der Code im Beispiel ist nicht sehr elegant, erfüllt aber seinen Zweck:
Code: Alles auswählen
sub Main2
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
i = 10
Do
i = i + 1
tmp = ThisComponent.Sheets(0).getCellByPosition(3, i).FormulaLocal
Loop While tmp <> ""
With ThisComponent.Sheets(0)
.getCellByPosition(3, i).String = .getCellByPosition(0, 1).String
.getCellByPosition(4, i).String = .getCellByPosition(1, 1).String
.getCellByPosition(0, 1).FormulaLocal = ""
.getCellByPosition(1, 1).FormulaLocal = ""
End With
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())
end sub
Gruß
Stephan
- Dateianhänge
-
- Beispiel.ods
- (10.79 KiB) 109-mal heruntergeladen
[quote]Schwebt mir vor, ist aber wohl ein Traumwunsch?
[/quote]
Nein, im Normalfall nicht. Ob im Detail genau das umzusetzen ist was Du haben willst hängt natürlich von den Anforderungen ab.
Im Anhang ein Beispiel das nur auf Tastendruck einige Werte kopiert und löscht und eine Zelle in den Edit-Modus versetzt.
Hinweis:
der Code im Beispiel ist nicht sehr elegant, erfüllt aber seinen Zweck:
[code]sub Main2
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
i = 10
Do
i = i + 1
tmp = ThisComponent.Sheets(0).getCellByPosition(3, i).FormulaLocal
Loop While tmp <> ""
With ThisComponent.Sheets(0)
.getCellByPosition(3, i).String = .getCellByPosition(0, 1).String
.getCellByPosition(4, i).String = .getCellByPosition(1, 1).String
.getCellByPosition(0, 1).FormulaLocal = ""
.getCellByPosition(1, 1).FormulaLocal = ""
End With
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())
end sub[/code]
Gruß
Stephan