org.apache.poi.xssf.usermodel
Class XSSFDataFormat

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

public class XSSFDataFormat
extends java.lang.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


Constructor Summary
protected XSSFDataFormat(StylesTable stylesSource)
           
 
Method Summary
 java.lang.String getFormat(int index)
          Deprecated. POI 3.16 beta 1 - use getFormat(short) instead
 java.lang.String getFormat(short index)
          get the format string that matches the given format index
 short getFormat(java.lang.String format)
          Get the format index that matches the given format string, creating a new format entry if required.
 void putFormat(short index, java.lang.String format)
          Add a number format with a specific ID into the number format style table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSSFDataFormat

protected XSSFDataFormat(StylesTable stylesSource)
Method Detail

getFormat

public short getFormat(java.lang.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 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

getFormat

@Removal(version="3.18")
public java.lang.String getFormat(int index)
Deprecated. POI 3.16 beta 1 - use getFormat(short) instead

get the format string that matches the given format index

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,
                      java.lang.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


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