Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index


Hallo Gisbert,

Marcelly und Godard geben in ihrem Buch "Programmation OpenOffice.org et LibreOffice zwei Beispiele, wie man Calc-Funktionen von anderen Modulen aus aufruft. Ich habe es selber nicht probiert.Ich schicke dir nur die Makros, du bist ja wahrlich kein Anfänger, das wird dir sicher genügen:

rem Code09-03.ods bibli : Fonctions Module1
Option Explicit
Sub UtiliserFonctionCalc()
Dim params As Variant
params = Array(35,75,1110)
print PPCM(params())
' appel sans utiliser de variable intermédiaire
print PPCM(Array(17, 525, 357, 76, 54))
End Sub
Function PPCM(liste As Variant) As Long
Dim acceder As Object
acceder = CreateUnoService("com.sun.star.sheet.FunctionAccess")
PPCM = acceder.callFunction("LCM", liste)
End Function

und das zweite:

rem Code09-03.ods bibli : Fonctions Module1
Option Explicit
Sub UtiliserFonctionCalc()
Dim params As Variant
params = Array(35,75,1110)
print PPCM(params())
' appel sans utiliser de variable intermédiaire
print PPCM(Array(17, 525, 357, 76, 54))
End Sub
Function PPCM(liste As Variant) As Long
Dim acceder As Object
acceder = CreateUnoService("com.sun.star.sheet.FunctionAccess")
PPCM = acceder.callFunction("LCM", liste)
End Function

Gruß

Gerhard

Am 19.04.2018 um 18:00 schrieb dmaths:
Hallo,
bis jetzt habe ich in Base eine rudimentäre
Übersetzung von Zahlen in Worte
mit einer kleinen zweispaltigen Tabelle "inWorten" und
einer Abfrage bewerkstelligt:


SELECT  ( "Betrag" / 1000 ) AS "z", ...
...
"inWorten"."text" || 'tausend' AS "BETRAGINWORTEN", ...
...
WHERE "inWorten"."zahl" = "z"
...

Das geht solange gut wie als "Betrag" nur ganze Tausender vorkommen.
Ansonsten wird das ganze ziemlich unübersichtlich...

Für Calc gibt es ja die Extension numbertext.oxt, die eine Funktion
NUMBERTEXT(z;"Sprachcode") zur Verfügung stellt und diese Übersetzung eigentlich ganz schön macht. Aber eben nur in Calc-Formeln.

Muss man nun in Base (im Hintergrund) per Makro
- erst ein Calc-Dokument erzeugen,
- die Zahl eintragen
- die Funktion NUMBERTEXT verwenden
- das Ergebnis auslesen
- das Calc-Dokument wieder zumachen?

Oder Weiß jemand einen eleganten Weg um mit einem Makro in Base direkt eine Calc-Funktion zu verwenden?

Auf der Seite numbertext.org findet sich (neben der LO-Extension) auch noch eine Java-Datei numbertext.jar, die jemand vielleicht so in LibreOffice installieren könnte, dass man von Base aus darauf zugreifen könnte??
- LibreOffie ist doch so unglaublich flexibel erweiterbar!?

Mit hoffnungsvollen Grüßen
Gisbert





--
Liste abmelden mit E-Mail an: users+unsubscribe@de.libreoffice.org
Probleme? https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Alle E-Mails an diese Liste werden unlöschbar öffentlich archiviert

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.