Ciao tutti due,

Paolo Mantovani a écrit :
Ciao Jack, Francois,

Il mercoledì 30 aprile 2008 23:38:35 jack ha scritto:
On Wed, Apr 30, 2008 at 5:35 PM, Francois Gatto <[EMAIL PROTECTED]>

wrote:
Salve,

Provi con questa macro

Sub SetNumFormat
[...]
Ti ringrazio innanzitutto della risposta :(

Ho provato la tua macro (sostituendo solo i country e language code con
"it") ma non ha sortito l' effetto voluto: la formattazione delle celle
dopo l' esecuzione e' quella numerica standard :(

Io ho provato e da me funziona perfettamente.

C' e' una lista di tutti i NumberFormat?

Potrei sbagliarmi ma non mi risulta che si possa ricavare una lista in modo semplice.
Esatto.

Si puo ottenere una lista dei NumberFormat che sono registratti e in funzione dello worksheet aperto.

Con questa macro que ho adaptato per Calc, si puo listare questi numbers. Pero no si puo avere i numeri degli formatti che non esistono ,che non sono registratti.

Sub enumFormats()
  'Author : Laurent Godard
  'e-mail : [EMAIL PROTECTED]
  'Modified : Andrew Pitonyak
  Dim oDoc as object
  Dim oCell as object
  Dim vFormats, vFormat
  Dim vTextCursor, vViewCursor
  Dim iMax As Integer, i As Integer
  Dim s$
  Dim PrevChaine$, Chaine$
  Dim aLocale As New com.sun.star.lang.Locale

  oDoc = ThisComponent
  'oSheet = oDoc.Sheets.getByName("Feuille1")
  oSheet = ThisComponent.currentController.activeSheet
  vFormats = oDoc.getNumberFormats()
  Dim v
  v = vFormats.queryKeys(com.sun.star.util.NumberFormat.ALL, aLocale, true)
  For i = LBound(v) To UBound(v)
    vFormat=vFormats.getbykey(v(i))
    chaine=VFormat.FormatString
    If Chaine<>Prevchaine Then
      PrevChaine=Chaine
      chaine=right("0000"&CStr(v(i)),4) & " - " & chaine
      oCell = oSheet.getCellByPosition(3,0+i) 'Col D
      oCell.String = chaine
    End If
  Next
  MsgBox "Finished"
End Sub

La strada suggerita da Francois è quella giusta, secondo me dovresti approfondire perchè deve funzionare.

In fatti, la soluzione (sola ?!) e di generare il format che abbiamo bisogno nel worksheet.

NB :
La buona soluzione dovrebbe essere quella proposta o di usare delle constante. Vedere qui: http://api.openoffice.org/docs/common/ref/com/sun/star/i18n/NumberFormatIndex.html
http://doc.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Managing_Number_Formats
Tutt'una storia ;-)

50
ciao
Paolo M

Francois Gatto


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

Rispondere a