Bon, je fais avancer mon Shmilblick...

En fait il apparait que c'est avec le getByKey que j'ai des problèmes. Vous
pouvez essayer le code ci dessous, qui indique que '# ##0' est différent de
'# ##0' !!!???... ;-((((

S1 est codé en dur comme '# ##0', S2 est affecté par le 3ème format de la
liste qui est égal à '# ##0'. Le test avec S1 ne fonctionne pas, celui avec
S2 fonctionne.

Une idée ?
JCD

Sub Test
Dim i as Integer
Dim NLS As New com.sun.star.lang.Locale
dim s1 as String 
dim s2 as String 
dim oFormats as Object 
dim oFormat as Object 

        s1 = "# ##0"

        oFormats = ThisComponent.getNumberFormats()
        oFormat = oFormats.getByKey(3)
        s2 = oFormat.FormatString()       
        
        if (s1 <> s2) then
                MsgBox "s1 <> s2 (S1 = '" & s1 & "', s2 = '" & s2 & "')",
sbOkOnly, Titre_Appli
                MsgBox "oFormat.FormatString = " & oFormat.FormatString
                MsgBox "oFormat.Locale.Language = " &
oFormat.Locale.Language
                MsgBox "oFormat.Locale.Country = " & oFormat.Locale.Country
                MsgBox "oFormat.Locale.Variant = " & oFormat.Locale.Variant
                MsgBox "oFormat.Type = " & oFormat.Type '16 ==> Type =
"NUMBER"
                MsgBox "oFormat.Comment = " & oFormat.Comment
        else
                MsgBox "s1 = s2 (S1 = '" & s1 & "', s2 = '" & s2 & "')"
        end if
        
        'Test 1 with s2 
    i = oFormats.queryKey ( s2, NLS, TRUE)
        MsgBox "With s2, i = '" & i & "'"
        
        'Test with s1
        NLS.Language = "fr"
        NLS.Country = "FR"
    i = oFormats.queryKey ( s1, NLS, TRUE)
        MsgBox "With s1, i = '" & i & "'"
        
        'Test 2 with s2 (with NLS Specified)
    i = oFormats.queryKey ( s2, NLS, TRUE)
        MsgBox "With s2, i = '" & i & "'"
End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à