Package org.apache.poi.xssf.model
Interface Styles
- All Known Implementing Classes:
StylesTable
public interface Styles
-
Method Summary
Modifier and TypeMethodDescriptiongetBorderAt
(int idx) getFillAt
(int idx) getFontAt
(int idx) getNumberFormatAt
(short fmtId) Get number format string given its idint
int
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
Records the given font in the font table.int
Records the given font in the font table.void
putNumberFormat
(short index, String fmt) Add a number format with a specific ID into the numberFormats map.int
putNumberFormat
(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
(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 Details
-
getNumberFormatAt
Get number format string given its id- Parameters:
fmtId
- number format id- Returns:
- number format code
-
putNumberFormat
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:
IllegalStateException
- if adding the number format to the styles table would exceed the max allowed.
-
putNumberFormat
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
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
-
putFont
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
Records the given font in the font table. Will re-use an existing font index if this font matches another. -
getStyleAt
- Parameters:
idx
- style index- Returns:
- XSSFCellStyle or null if idx is out of bounds for xfs array
-
putStyle
-
getBorderAt
-
putBorder
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
-
putFill
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()
-