org.apache.poi.hssf.usermodel
Class HSSFDataFormat

java.lang.Object
  extended by 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.

Author:
Andrew C. Oliver (acoliver at apache dot org), Shawn M. Laubach (slaubach at apache dot org)

Method Summary
static java.lang.String getBuiltinFormat(short index)
          get the format string that matches the given format index
static short getBuiltinFormat(java.lang.String format)
          get the format index that matches the given format string
static java.util.List<java.lang.String> getBuiltinFormats()
           
 java.lang.String getFormat(short index)
          get the format string that matches the given format index
 short 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 string

Automatically 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 interface DataFormat
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 interface DataFormat
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


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.