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 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).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getBuiltinFormat(short index)
get the format string that matches the given format indexstatic short
getBuiltinFormat(String format)
get the format index that matches the given format stringstatic List<String>
getBuiltinFormats()
String
getFormat(short index)
get the format string that matches the given format indexshort
getFormat(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 builtinFormatsshort
newFormat(String format)
-
-
-
Method Detail
-
getBuiltinFormat
public static short getBuiltinFormat(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(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 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 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
-
newFormat
public short newFormat(String format)
-
-