Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

(calc) formattazione celle

148 views
Skip to first unread message

Jorma

unread,
Jan 31, 2014, 3:19:26 AM1/31/14
to
Ciao a tutti
come posso definire un formato che all'inserimento del valore mi mostri
in cella anche l'unità di misura?

es. digito 150 e mi compare 150 Km piuttosto che 150 Kg

grazie

Jorma

VITRIOL

unread,
Jan 31, 2014, 3:53:30 AM1/31/14
to
Il 31/01/2014 09:19, Jorma ha scritto:

> es. digito 150 e mi compare 150 Km piuttosto che 150 Kg

Prova a aggiungere [$stringa] al formato personalizzato. Ad esempio:

Standard[$ Km]

Non sono sicurissimo che non ci siano effetti collaterali, facci sapere :-)

--
Saluti
VITRIOL

Jorma

unread,
Jan 31, 2014, 5:25:52 AM1/31/14
to
sembra fungere senza problemi.. :-)

avevo provato con formule del tipo
# "Km"
oppure
0 "Km"
e andavano anche bene tranne che per il fatto che o arrotondavano o
mettevano ,0 anche in assenza di decimali

thanks

Jorma

Luigi

unread,
Feb 1, 2014, 2:53:59 AM2/1/14
to
Jorma ci ha detto :
Ciao, se è una cosa da fare spesso io mi sono creato una macro e poi
l'ho associata ad un nuovo bottone sulla barra di LibO. Nel caso
specifico è per i metri, ma basta modificare NumberFormatString e puoi
crearti tutte le unità di misura necessarie.

sub FormatoMetri
dim dispatcher as object
Dim Doc As Object
Dim NumberFormats As Object
Dim NumberFormatString As String
Dim NumberFormatId As Long
Dim LocalSettings As New com.sun.star.lang.Locale
Doc = StarDesktop.CurrentComponent
LocalSettings.Language = "it"
LocalSettings.Country = "it"
NumberFormats = Doc.NumberFormats
NumberFormatString = "[$m-410] #.##0,00;[RED]-[$m-410] #.##0,00" rem
inserire il codice testuale x il formato
rem aggiungere ;"" dopo il formato per non vedere gli zeri ?????????
NumberFormatId = NumberFormats.queryKey(NumberFormatString,
LocalSettings, True)
If NumberFormatId = -1 Then
NumberFormatId = NumberFormats.addNew(NumberFormatString,
LocalSettings)
End If
rem
----------------------------------------------------------------------
rem get access to the document
doc = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem
----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "NumberFormatValue"
args1(0).Value = numberformatid
dispatcher.executeDispatch(doc, ".uno:NumberFormatValue", "", 0,
args1())
end sub


basta salvarla tra le macro di LibO in modo sia sempre disponibile.
Spero di essere stato d'aiuto.
Saluti.
LuigiZ


Jorma

unread,
Feb 3, 2014, 3:27:35 AM2/3/14
to
molto interessante!
provo a farlo
grazie

saluti

Jorma
0 new messages