Class XSSFDataFormat

java.lang.Object
org.apache.poi.xssf.usermodel.XSSFDataFormat
All Implemented Interfaces:
DataFormat

public class XSSFDataFormat extends Object implements DataFormat
Handles data formats for XSSF. Per Microsoft Excel 2007+ format limitations: Workbooks support between 200 and 250 "number formats" (POI calls them "data formats") So short or even byte would be acceptable data types to use for referring to data format indices. https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
  • Method Summary

    Modifier and Type
    Method
    Description
    getFormat(short index)
    get the format string that matches the given format index
    short
    getFormat(String format)
    Get the format index that matches the given format string, creating a new format entry if required.
    void
    putFormat(short index, String format)
    Add a number format with a specific ID into the number format style table.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getFormat

      public short getFormat(String format)
      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:
      format - 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
    • putFormat

      public void putFormat(short index, String format)
      Add a number format with a specific ID into the number format style table. If a format with the same ID already exists, overwrite the format code with fmt This may be used to override built-in number formats.
      Parameters:
      index - the number format ID
      format - the number format code