:: com :: sun :: star :: util ::

interface XNumberFormats
Description
provides access to multiple NumberFormats. The number formats are managed by their unique key in the document.
Developers Guide
OfficeDev - Number Formats

Methods' Summary
getByKey  
queryKeys  
queryKey finds a number format by its format string and returns its key.  
addNew adds a new number format to the list, using a format string.  
addNewConverted adds a new number format to the list, using a format string in a different locale than the desired locale of the resulting number format.  
removeByKey removes a number format from the list.  
generateFormat generates a format string from several parameters without creating an actual number format.  
Methods' Details
getByKey
::com::sun::star::beans::XPropertySet
getByKey( [in] long  nKey );

Returns
a readonly NumberFormatProperties.
Parameter nKey
the key for the format
queryKeys
sequence< long >
queryKeys( [in] short  nType,
[in] ::com::sun::star::lang::Locale  nLocale,
[in] boolean  bCreate );

Returns
a sequence of the keys of all number formats with the specified type and language.
Parameter nType
the type of number formats to return. Must be one of the NumberFormat constants.
Parameter nLocale
the locale of number formats to return.
Parameter bCreate
true: create new entries if no formats for the selected language exist
false: return an empty list if no formats for the selected language exist
queryKey
long
queryKey( [in] string  aFormat,
[in] ::com::sun::star::lang::Locale  nLocale,
[in] boolean  bScan );

Description
finds a number format by its format string and returns its key.
Returns
the key for the format if found, otherwise -1.
Parameter aFormat
the string representation of the number format
Parameter nLocale
the locale for number formats to find
Parameter bScan
reserved for future use and should be set to false
addNew
long
addNew( [in] string  aFormat,
[in] ::com::sun::star::lang::Locale  nLocale )
raises( MalformedNumberFormatException );

Description
adds a new number format to the list, using a format string.
Returns
the key for new number format
Parameter aFormat
the string representation of the number format
Parameter nLocale
the locale for the number format
Throws
com::sun::star::util::MalformedNumberFormatException if incorrect number format is specified
addNewConverted
long
addNewConverted( [in] string  aFormat,
[in] ::com::sun::star::lang::Locale  nLocale,
[in] ::com::sun::star::lang::Locale  nNewLocale )
raises( MalformedNumberFormatException );

Description
adds a new number format to the list, using a format string in a different locale than the desired locale of the resulting number format.
Returns
the key for added number format
Parameter aFormat
the key for the number format
Parameter nLocale
the original locale for the number format
Parameter nNewLocale
the new locale for the number format to be converted
Throws
com::sun::star::util::MalformedNumberFormatException if incorrect number format is specified
removeByKey
void
removeByKey( [in] long  nKey );

Description
removes a number format from the list.
Parameter nKey
the key for the numberformat
generateFormat
string
generateFormat( [in] long  nBaseKey,
[in] ::com::sun::star::lang::Locale  nLocale,
[in] boolean  bThousands,
[in] boolean  bRed,
[in] short  nDecimals,
[in] short  nLeading );

Description
generates a format string from several parameters without creating an actual number format.
Returns
the string representation for the number format
Parameter nBaseKey
the key for the number format to be used as base format
Parameter nLocale
the locale for the number format
Parameter bThousands
the thousands separator is shown or not
Parameter bRed
show negative number in red colored if true
Parameter nDecimals
how many digits are shown after the decimal point
Parameter nLeading
how many number of leading zeros are shown
Top of Page