org.simpleods
public class NumberStyle extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
NUMBER_FRACTION |
static int |
NUMBER_NORMAL |
static int |
NUMBER_PERCENTAGE |
static int |
NUMBER_SCIENTIFIC |
Constructor and Description |
---|
NumberStyle(java.lang.String sStyleName,
int nMinIntDigits,
int nDecPlaces,
OdsFile odsFile)
Create a new number style with the name sName, minimum integer digits is
nMinIntDigits and decimal places is nDecPlaces.
|
NumberStyle(java.lang.String sStyleName,
OdsFile odsFile)
Create a new number style with the name sName, default minimum integer
digits is 1 and default decimal places is 2.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCountry() |
int |
getDecimalPlaces()
Get how many digits are to the right of the decimal symbol.
|
java.lang.String |
getLanguage() |
int |
getMinExponentDigits()
Get the current number of leading zeros.
|
int |
getMinIntegerDigits()
Get how many leading zeros are present.
|
java.lang.String |
getName() |
boolean |
getThousandsSeparator()
Get the current status of the thousands separator.
|
boolean |
isNegativeValuesRed()
Check if this style shows a red color for negative numbers.
|
void |
setCountry(java.lang.String country)
Set the country and language if you need to distinguish between different countries.
|
void |
setDecimalPlaces(int decimalPlaces)
Set how many digits are to the right of the decimal symbol.
|
void |
setFractionValues(int nNumerator,
int nDenominator)
Add the numerator and denominator values to be shown.
|
void |
setLanguage(java.lang.String language)
Set the country and language if you need to distinguish between different
countries. |
void |
setMinExponentDigits(int minExponentDigits)
Set the number of exponent digits.
|
void |
setMinIntegerDigits(int minIntegerDigits)
Set how many leading zeros are present.
|
void |
setName(java.lang.String name)
Set the name of this style to sName, this name must be unique.
|
void |
setNegativeValuesRed(boolean bValue)
Set to true if negative values should be shown in red color.
|
void |
setNumberType(int nType)
Set the number type for this style.
|
void |
setThousandsSeparator(boolean grouping)
If this is set to true, the thousands separator is shown.
|
void |
setToPercentageStyle()
Set the number format to percentage.
|
java.lang.String |
toXML()
Write the XML format for this object.
|
public static final int NUMBER_NORMAL
public static final int NUMBER_SCIENTIFIC
public static final int NUMBER_FRACTION
public static final int NUMBER_PERCENTAGE
public NumberStyle(java.lang.String sStyleName, OdsFile odsFile)
sStyleName
- The name of the number style, this name must be unique.odsFile
- The OdsFile to which this style belongs to.public NumberStyle(java.lang.String sStyleName, int nMinIntDigits, int nDecPlaces, OdsFile odsFile)
sStyleName
- The name of the number style, this name must be unique.nMinIntDigits
- The minimum integer digits to be shown.nDecPlaces
- The number of decimal places to be shown.odsFile
- The OdsFile to which this style belongs to.public int getDecimalPlaces()
public final void setDecimalPlaces(int decimalPlaces)
decimalPlaces
- - The number of digitspublic int getMinIntegerDigits()
public final void setMinIntegerDigits(int minIntegerDigits)
minIntegerDigits
- The number of leading zerospublic int getMinExponentDigits()
public void setMinExponentDigits(int minExponentDigits)
minExponentDigits
- The minimum of exponent digits to be usedpublic void setFractionValues(int nNumerator, int nDenominator)
nNumerator
- nDenominator
- public void setNumberType(int nType)
nType
- The number type to be used.public boolean getThousandsSeparator()
public void setThousandsSeparator(boolean grouping)
grouping
- true, the thousands separator is shownpublic java.lang.String getName()
public final void setName(java.lang.String name)
name
- - The name of this style.public java.lang.String getLanguage()
public void setLanguage(java.lang.String language)
language
- The two letter language code, e.g. 'en'public java.lang.String getCountry()
public void setCountry(java.lang.String country)
country
- The two letter country code, e.g. 'US'public boolean isNegativeValuesRed()
public void setNegativeValuesRed(boolean bValue)
bValue
- true negative numbers will be shown in red color.public void setToPercentageStyle()
public java.lang.String toXML()