Package org.apache.poi.xssf.model
Interface Styles
-
- All Known Implementing Classes:
StylesTable
public interface Styles
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description XSSFCellBorder
getBorderAt(int idx)
XSSFCellFill
getFillAt(int idx)
XSSFFont
getFontAt(int idx)
java.lang.String
getNumberFormatAt(short fmtId)
Get number format string given its idint
getNumCellStyles()
int
getNumDataFormats()
XSSFCellStyle
getStyleAt(int idx)
int
putBorder(XSSFCellBorder border)
Adds a border to the border style table if it isn't already in the style table Does nothing if border is already in borders style tableint
putFill(XSSFCellFill fill)
Adds a fill to the fill style table if it isn't already in the style table Does nothing if fill is already in fill style tableint
putFont(XSSFFont font)
Records the given font in the font table.int
putFont(XSSFFont font, boolean forceRegistration)
Records the given font in the font table.void
putNumberFormat(short index, java.lang.String fmt)
Add a number format with a specific ID into the numberFormats map.int
putNumberFormat(java.lang.String fmt)
Putsfmt
in the numberFormats map if the format is not already in the the number format style table.int
putStyle(XSSFCellStyle style)
boolean
removeNumberFormat(short index)
Remove a number format from the style table if it exists.boolean
removeNumberFormat(java.lang.String fmt)
Remove a number format from the style table if it exists All cell styles with this number format will be modified to use the default number format
-
-
-
Method Detail
-
getNumberFormatAt
java.lang.String getNumberFormatAt(short fmtId)
Get number format string given its id- Parameters:
fmtId
- number format id- Returns:
- number format code
-
putNumberFormat
int putNumberFormat(java.lang.String fmt)
Putsfmt
in the numberFormats map if the format is not already in the the number format style table. Does nothing iffmt
is already in number format style table.- Parameters:
fmt
- the number format to add to number format style table- Returns:
- the index of
fmt
in the number format style table - Throws:
java.lang.IllegalStateException
- if adding the number format to the styles table would exceed the max allowed.
-
putNumberFormat
void putNumberFormat(short index, java.lang.String fmt)
Add a number format with a specific ID into the numberFormats map. 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 IDfmt
- the number format code
-
removeNumberFormat
boolean removeNumberFormat(short index)
Remove a number format from the style table if it exists. All cell styles with this number format will be modified to use the default number format.- Parameters:
index
- the number format id to remove- Returns:
- true if the number format was removed
-
removeNumberFormat
boolean removeNumberFormat(java.lang.String fmt)
Remove a number format from the style table if it exists All cell styles with this number format will be modified to use the default number format- Parameters:
fmt
- the number format to remove- Returns:
- true if the number format was removed
-
getFontAt
XSSFFont getFontAt(int idx)
-
putFont
int putFont(XSSFFont font, boolean forceRegistration)
Records the given font in the font table. Will re-use an existing font index if this font matches another, EXCEPT if forced registration is requested. This allows people to create several fonts then customise them later. Note - End Users probably want to callXSSFFont.registerTo(StylesTable)
-
putFont
int putFont(XSSFFont font)
Records the given font in the font table. Will re-use an existing font index if this font matches another.
-
getStyleAt
XSSFCellStyle getStyleAt(int idx)
- Parameters:
idx
- style index- Returns:
- XSSFCellStyle or null if idx is out of bounds for xfs array
-
putStyle
int putStyle(XSSFCellStyle style)
-
getBorderAt
XSSFCellBorder getBorderAt(int idx)
-
putBorder
int putBorder(XSSFCellBorder border)
Adds a border to the border style table if it isn't already in the style table Does nothing if border is already in borders style table- Parameters:
border
- border to add- Returns:
- the index of the added border
-
getFillAt
XSSFCellFill getFillAt(int idx)
-
putFill
int putFill(XSSFCellFill fill)
Adds a fill to the fill style table if it isn't already in the style table Does nothing if fill is already in fill style table- Parameters:
fill
- fill to add- Returns:
- the index of the added fill
-
getNumCellStyles
int getNumCellStyles()
-
getNumDataFormats
int getNumDataFormats()
-
-