4 messages in org.openoffice.fr.prog[prog] Ajout d'un Numberformat en 2.0
FromSent OnAttachments
DAVID Jean-Claude - CETE Ouest/DU/AEHMar 15, 2006 5:21 am 
DAVID Jean-Claude - CETE Ouest/DU/AEHMar 15, 2006 7:33 am 
pacMar 15, 2006 7:39 am 
DAVID Jean-Claude - CETE Ouest/DU/AEHMar 15, 2006 7:55 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[prog] Ajout d'un Numberformat en 2.0Actions...
From:DAVID Jean-Claude - CETE Ouest/DU/AEH (Jean@i-carre.net)
Date:Mar 15, 2006 5:21:55 am
List:org.openoffice.fr.prog

Bonjour, J'ai développé une appli en 1.1 au printemps 2004 (je n'ai plus refait de StarBasic depuis), et aujourd'hui je regarde la migration en 2.02.rc4 et je tombe sur la 1ère erreur ;-) Soit... après quelques essais divers infructeux, je reprends une macro exemple originale qui va bien (généralement) sur l'ajout de formats de nombres, d'Andrew PITONYAK, et o stupeur elle bugue egalement ;-( Je l'exécute en 1.1.5, elle fonctionne correctement. Bon, j'ai fait un pas en avant, ce n'est pas que mon code qui lève l'erreur mais également celui d'Andrew ;-) ça reconforte, mais cela ne me fait pas beaucoup progresser... L'erreur est une com.sun.star.uno.RuntimeException sur la ligne addNew à la fin de la macro Ais je loupé des choses sur l'évolution de la programmation en 2.0 ? Qulequ'un a t'il une piste à explorer ?

D'avance merci JCD

Sub Test Dim i as Integer i = FindCreateNumberFormatStyle( "# ##0", ThisComponent) MsgBox "i = '" & i & "'", sbOkOnly, Titre_Appli End Sub

'Author: Andrew Pitonyak 'email: and@pitonyak.org Function FindCreateNumberFormatStyle ( sFormat As String, Optional doc, Optional locale)

Dim oDocument As Object Dim aLocale As New com.sun.star.lang.Locale Dim oFormats As Object Dim formatNum As Long

oDocument = IIf(IsMissing(doc), ThisComponent, doc) oFormats = oDocument.getNumberFormats()

'If you choose to query on types, you need to use the type 'com.sun.star.util.NumberFormat.DATE 'I could set the locale from values stored at 'http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt 'http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html 'I use a NULL locale and let it use what ever it likes. 'First, see if the number format exists If ( Not IsMissing(locale)) Then aLocale = locale End If

formatNum = oFormats.queryKey (sFormat, aLocale, TRUE) MsgBox "Current Format number is " & formatNum 'If the number format does not exist then add it If (formatNum = -1) Then formatNum = oFormats.addNew(sFormat, aLocale) If (formatNum = -1) Then formatNum = 0 MsgBox "New Format number is " & formatNum End If FindCreateNumberFormatStyle = formatNum End Function