LibreOffice LibreOffice 25.2 SDK API Reference

Public Member Functions | List of all members
XNumberFormatter Interface Referencepublished

represents a number formatter. More...

`import"XNumberFormatter.idl";`

Inheritance diagram for XNumberFormatter:

## Public Member Functions
void | attachNumberFormatsSupplier ([in] com::sun::star::util::XNumberFormatsSupplier xSupplier)
| attaches an XNumberFormatsSupplier to this NumberFormatter. More...
com::sun::star::util::XNumberFormatsSupplier | getNumberFormatsSupplier ()
long | detectNumberFormat ([in] long nKey, [in] string aString) raises ( com::sun::star::util::NotNumericException )
| detects the number format in a string which contains a formatted number. More...
double | convertStringToNumber ([in] long nKey, [in] string aString) raises ( com::sun::star::util::NotNumericException )
| converts a string which contains a formatted number into a number. More...
string | convertNumberToString ([in] long nKey, [in] double fValue)
| converts a number into a string. More...
com::sun::star::util::Color | queryColorForNumber ([in] long nKey, [in] double fValue, [in] com::sun::star::util::Color aDefaultColor)
string | formatString ([in] long nKey, [in] string aString)
| converts a string into another string. More...
com::sun::star::util::Color | queryColorForString ([in] long nKey, [in] string aString, [in] com::sun::star::util::Color aDefaultColor)
string | getInputString ([in] long nKey, [in] double fValue)
| converts a number into a string with the specified format. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

represents a number formatter.

Developers Guide
  Office Development - Number Formats

## Member Function Documentation

## ◆ attachNumberFormatsSupplier()

void attachNumberFormatsSupplier | ( | [in] com::sun::star::util::XNumberFormatsSupplier | xSupplier | ) |

attaches an XNumberFormatsSupplier to this NumberFormatter.

This NumberFormatter will only use the NumberFormats specified in the attached XNumberFormatsSupplier. Without an attached XNumberFormatsSupplier, no formatting is possible.

## ◆ convertNumberToString()

string convertNumberToString | ( | [in] long | nKey,
|  | [in] double | fValue
| ) |  |

converts a number into a string.

## ◆ convertStringToNumber()

double convertStringToNumber | ( | [in] long | nKey,
|  | [in] string | aString
| ) |  |
raises | ( | com::sun::star::util::NotNumericException
| ) |  |

converts a string which contains a formatted number into a number.

If this is a text format, the string will not be converted.

## ◆ detectNumberFormat()

long detectNumberFormat | ( | [in] long | nKey,
|  | [in] string | aString
| ) |  |
raises | ( | com::sun::star::util::NotNumericException
| ) |  |

detects the number format in a string which contains a formatted number.

## ◆ formatString()

string formatString | ( | [in] long | nKey,
|  | [in] string | aString
| ) |  |

converts a string into another string.

## ◆ getInputString()

string getInputString | ( | [in] long | nKey,
|  | [in] double | fValue
| ) |  |

converts a number into a string with the specified format.

This string can always be converted back to a number using the same format.

## ◆ getNumberFormatsSupplier()

com::sun::star::util::XNumberFormatsSupplier getNumberFormatsSupplier | ( |  | ) |

Returns
  the attached XNumberFormatsSupplier.

## ◆ queryColorForNumber()

com::sun::star::util::Color queryColorForNumber | ( | [in] long | nKey,
|  | [in] double | fValue,
|  | [in] com::sun::star::util::Color | aDefaultColor
| ) |  |

Returns
  the color which is specified for the given value in the number format, which is otherwise the value of aDefaultColor.

## ◆ queryColorForString()

com::sun::star::util::Color queryColorForString | ( | [in] long | nKey,
|  | [in] string | aString,
|  | [in] com::sun::star::util::Color | aDefaultColor
| ) |  |

Returns
  the color which is specified for the given string in the number format, which is otherwise the value of aDefaultColor.

The documentation for this interface was generated from the following file:

- com/sun/star/util/XNumberFormatter.idl