Package org.apache.poi.hssf.usermodel
Class HSSFDataFormat
- java.lang.Object
-
- org.apache.poi.hssf.usermodel.HSSFDataFormat
-
- All Implemented Interfaces:
DataFormat
public final class HSSFDataFormat extends java.lang.Object implements DataFormat
Identifies both built-in and user defined formats within a workbook.See
BuiltinFormats
for a list of supported built-in formats.International Formats
Since version 2003 Excel has supported international formats. These are denoted with a prefix "[$-xxx]" (where xxx is a 1-7 digit hexadecimal number). See the Microsoft article Creating international number formats for more details on these codes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getBuiltinFormat(short index)
get the format string that matches the given format indexstatic short
getBuiltinFormat(java.lang.String format)
get the format index that matches the given format stringstatic java.util.List<java.lang.String>
getBuiltinFormats()
java.lang.String
getFormat(short index)
get the format string that matches the given format indexshort
getFormat(java.lang.String pFormat)
Get the format index that matches the given format string, creating a new format entry if required.static int
getNumberOfBuiltinBuiltinFormats()
get the number of built-in and reserved builtinFormats
-
-
-
Method Detail
-
getBuiltinFormats
public static java.util.List<java.lang.String> getBuiltinFormats()
-
getBuiltinFormat
public static short getBuiltinFormat(java.lang.String format)
get the format index that matches the given format stringAutomatically converts "text" to excel's format string to represent text.
- Parameters:
format
- string matching a built in format- Returns:
- index of format or -1 if undefined.
-
getFormat
public short getFormat(java.lang.String pFormat)
Get the format index that matches the given format string, creating a new format entry if required. Aliases text to the proper format as required.- Specified by:
getFormat
in interfaceDataFormat
- Parameters:
pFormat
- string matching a built in format- Returns:
- index of format.
-
getFormat
public java.lang.String getFormat(short index)
get the format string that matches the given format index- Specified by:
getFormat
in interfaceDataFormat
- Parameters:
index
- of a format- Returns:
- string represented at index of format or null if there is not a format at that index
-
getBuiltinFormat
public static java.lang.String getBuiltinFormat(short index)
get the format string that matches the given format index- Parameters:
index
- of a built in format- Returns:
- string represented at index of format or null if there is not a builtin format at that index
-
getNumberOfBuiltinBuiltinFormats
public static int getNumberOfBuiltinBuiltinFormats()
get the number of built-in and reserved builtinFormats- Returns:
- number of built-in and reserved builtinFormats
-
-