Re: Calcfunktionen in Writer mit Basic nachbilden
Verfasst: Mi, 30.06.2010 23:12
Abend,
Du kannst die Tabellenfunktionen mit dem Interface XFunctionAccess von com.sun.star.sheet.FunctionAccess benutzen.
Siehe: http://api.openoffice.org/docs/common/r ... ccess.html
Den ggf. benötigten englischen Funktionsnamen bekommst Du so:
B1: =MITTELWERT(A1:A5)
liefert: =AVERAGE(A1:A5)
cu, Bernd
--
Du kannst die Tabellenfunktionen mit dem Interface XFunctionAccess von com.sun.star.sheet.FunctionAccess benutzen.
Siehe: http://api.openoffice.org/docs/common/r ... ccess.html
Den ggf. benötigten englischen Funktionsnamen bekommst Du so:
B1: =MITTELWERT(A1:A5)
Code: Alles auswählen
Sub x()
print ThisComponent.currentController.ActiveSheet.getCellRangeByName("B1").Formula
' print ThisComponent.sheets(0).getCellRangeByName("B1").Formula
End Sub
cu, Bernd
--
Code: Alles auswählen
REM ***** BASIC *****
Sub Main
oFunc = createUnoService("com.sun.star.sheet.FunctionAccess")
aArgs = Array(1,4,5,3,2)
print oFunc.callFunction("MIN", aArgs())
print oFunc.callFunction("MAX", aArgs())
print oFunc.callFunction("AVERAGE", aArgs())
End Sub