Laurent Godard a écrit :

Re Philippe


L'API de calc permet de manipuler ces formats
livre ed1 p309


sur cette base et si j'ai bien compris ton probleme, le code suivant devrait repondre a ton attente

Main va boucler sur tous les fields et appliquer le format desiré à tous les champs date

Je t'invite a en faire un codesnippet (si n'existe pas dejà)
http://codesnippets.services.openoffice.org/

Laurent
'------------------------
Sub Main

    theNumberFormat =  FindNumberFormatByString("J MMMM AAAA")
if theNumberFormat = -1 then
        print "invalid format - look at addNew"
    endif
theFieldsEnum = thisComponent.Textfields.createEnumeration() while theFieldsEnum.hasMoreElements()
        theField = theFieldsEnum.nextElement
if theField.supportsService("com.sun.star.text.TextField.DateTime") then
            theField.NumberFormat = theNumberFormat
        endif
    wend
    thisComponent.textfields.refresh()
    print "done"
End Sub

function FindNumberFormatByString(theFormatString) as long
dim aLocale as new com.sun.star.lang.Locale
    aLocale.country = "FR"
    aLocale.language = "fr"
theNumberFormats = thiscomponent.NumberFormats
    code = theNumberFormats.queryKey(theFormatString, aLocale, False )
FindNumberFormatByString = code

end function

Bonjour,
Désolé de la question toute bête :
codesnippet c'est quoi ?

Philippe (aussi)




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

Répondre à