Class 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).

    See Also:
    Review guidelines for customizing a number format
    • Method Detail

      • getBuiltinFormats

        public static List<String> getBuiltinFormats()
      • getBuiltinFormat

        public static short getBuiltinFormat​(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​(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 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 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)