Package org.apache.poi.xssf.usermodel
Class XSSFDataFormat
java.lang.Object
org.apache.poi.xssf.usermodel.XSSFDataFormat
- All Implemented Interfaces:
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 TypeMethodDescriptiongetFormat
(short index) get the format string that matches the given format indexshort
Get the format index that matches the given format string, creating a new format entry if required.void
Add a number format with a specific ID into the number format style table.
-
Method Details
-
getFormat
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:
format
- string matching a built-in format- Returns:
- index of format.
-
getFormat
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
-
putFormat
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 withfmt
This may be used to override built-in number formats.- Parameters:
index
- the number format IDformat
- the number format code
-