Package ch.rabanti.picoxlsx4j.style
Class NumberFormat
- java.lang.Object
-
- ch.rabanti.picoxlsx4j.style.AbstractStyle
-
- ch.rabanti.picoxlsx4j.style.NumberFormat
-
- All Implemented Interfaces:
Comparable<AbstractStyle>
public class NumberFormat extends AbstractStyle
Class representing a NumberFormat entry. The NumberFormat entry is used to define cell formats like currency or date- Author:
- Raphael Stoeckli
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NumberFormat.FormatNumber
Enum for predefined number formats
-
Field Summary
Fields Modifier and Type Field Description static int
CUSTOMFORMAT_START_NUMBER
Start ID for custom number formats as constant
-
Constructor Summary
Constructors Constructor Description NumberFormat()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumberFormat
copy()
Method to copy the current object to a new oneString
getCustomFormatCode()
Gets the custom format code in the notation of Excelint
getCustomFormatID()
Gets the format number of the custom format.NumberFormat.FormatNumber
getNumber()
Gets the format number.int
hashCode()
Override method to calculate the hash of this componentboolean
isCustomFormat()
Gets whether this object is a custom formatvoid
setCustomFormatCode(String customFormatCode)
Sets the custom format code in the notation of Excelvoid
setCustomFormatID(int customFormatID)
Sets the format number of the custom format.void
setNumber(NumberFormat.FormatNumber number)
Sets the format number.String
toString()
Override toString method-
Methods inherited from class ch.rabanti.picoxlsx4j.style.AbstractStyle
compareTo, equals, getInternalID, setInternalID
-
-
-
-
Field Detail
-
CUSTOMFORMAT_START_NUMBER
public static final int CUSTOMFORMAT_START_NUMBER
Start ID for custom number formats as constant- See Also:
- Constant Field Values
-
-
Method Detail
-
getNumber
public NumberFormat.FormatNumber getNumber()
Gets the format number. Set it to custom (164) in case of custom number formats- Returns:
- Format number
-
setNumber
public void setNumber(NumberFormat.FormatNumber number)
Sets the format number. Set it to custom (164) in case of custom number formats- Parameters:
number
- Format number
-
getCustomFormatID
public int getCustomFormatID()
Gets the format number of the custom format. Must be higher or equal then predefined custom number (164)- Returns:
- Format number of the custom format
-
setCustomFormatID
public void setCustomFormatID(int customFormatID)
Sets the format number of the custom format. Must be higher or equal then predefined custom number (164)- Parameters:
customFormatID
- Format number of the custom format
-
getCustomFormatCode
public String getCustomFormatCode()
Gets the custom format code in the notation of Excel- Returns:
- Custom format code
-
setCustomFormatCode
public void setCustomFormatCode(String customFormatCode)
Sets the custom format code in the notation of Excel- Parameters:
customFormatCode
- Custom format code
-
isCustomFormat
public boolean isCustomFormat()
Gets whether this object is a custom format- Returns:
- Returns true in case of a custom format (higher or equals 164)
-
toString
public String toString()
Override toString method
-
copy
public NumberFormat copy()
Method to copy the current object to a new one- Specified by:
copy
in classAbstractStyle
- Returns:
- Copy of the current object without the internal ID
-
-