Modifier and Type | Field and Description |
---|---|
static int |
FIRST_CUSTOM_STYLE_ID
The first style id available for use as a custom style
|
Constructor and Description |
---|
StylesTable()
Create a new, empty StylesTable
|
StylesTable(PackagePart part) |
Modifier and Type | Method and Description |
---|---|
int |
_getDXfsSize() |
int |
_getStyleXfsSize()
For unit testing only
|
XSSFCellStyle |
createCellStyle()
Create a cell style in this style table.
|
void |
ensureThemesTable()
If there isn't currently a
ThemesTable for the
current Workbook, then creates one and sets it up. |
XSSFFont |
findFont(boolean bold,
Color color,
short fontHeight,
String name,
boolean italic,
boolean strikeout,
short typeOffset,
byte underline)
Finds a font that matches the one with the supplied attributes,
where color is the actual Color-value, not the indexed color
|
XSSFFont |
findFont(boolean bold,
short color,
short fontHeight,
String name,
boolean italic,
boolean strikeout,
short typeOffset,
byte underline)
Finds a font that matches the one with the supplied attributes,
where color is the indexed-value, not the actual color.
|
XSSFCellBorder |
getBorderAt(int idx) |
List<XSSFCellBorder> |
getBorders() |
CTXf |
getCellStyleXfAt(int idx) |
CTXf |
getCellXfAt(int idx) |
CTStylesheet |
getCTStylesheet()
For unit testing only!
|
CTDxf |
getDxfAt(int idx) |
TableStyle |
getExplicitTableStyle(String name)
NOTE: this only returns explicitly defined styles
|
Set<String> |
getExplicitTableStyleNames() |
XSSFCellFill |
getFillAt(int idx) |
List<XSSFCellFill> |
getFills() |
XSSFFont |
getFontAt(int idx) |
List<XSSFFont> |
getFonts() |
IndexedColorMap |
getIndexedColors() |
int |
getMaxNumberOfDataFormats()
Get the upper limit on the number of data formats that has been set for the style table.
|
String |
getNumberFormatAt(short fmtId)
Get number format string given its id
|
Map<Short,String> |
getNumberFormats() |
int |
getNumCellStyles()
get the size of cell styles
|
int |
getNumDataFormats() |
XSSFCellStyle |
getStyleAt(int idx) |
TableStyle |
getTableStyle(String name) |
ThemesTable |
getTheme()
Get the current Workbook's theme table, or null if the
Workbook lacks any themes.
|
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
|
int |
putCellStyleXf(CTXf cellStyleXf)
Adds a cell style to the styles table.
|
int |
putCellXf(CTXf cellXf)
Adds a cell to the styles table.
|
int |
putDxf(CTDxf dxf)
Adds a Dxf to the style table
Does not check for duplicates.
|
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
|
int |
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,
String fmt)
Add a number format with a specific ID into the numberFormats map.
|
int |
putNumberFormat(String fmt)
Puts
fmt in the numberFormats map if the format is not
already in the the number format style table. |
int |
putStyle(XSSFCellStyle style) |
void |
readFrom(InputStream is)
Read this shared styles table from an XML file.
|
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
|
void |
replaceCellXfAt(int idx,
CTXf cellXf) |
void |
setMaxNumberOfDataFormats(int num)
Changes the maximum number of data formats that may be in a style table
|
void |
setTheme(ThemesTable theme) |
void |
setWorkbook(XSSFWorkbook wb) |
void |
writeTo(OutputStream out)
Write this table out as XML.
|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommited, isCommitted, setCommited, setCommitted, toString
public static final int FIRST_CUSTOM_STYLE_ID
public StylesTable()
public StylesTable(PackagePart part) throws IOException
IOException
public void setMaxNumberOfDataFormats(int num)
num
- the upper limit on number of data formats in the styles table when adding new data formatsIllegalArgumentException
- if num
< 0IllegalStateException
- if num
< current number of data formats in the style table.
Data formats must be explicitly removed before the limit can be decreased.public int getMaxNumberOfDataFormats()
getNumDataFormats()
.public void setWorkbook(XSSFWorkbook wb)
public ThemesTable getTheme()
Use ensureThemesTable()
to have a themes table
created if needed
public void setTheme(ThemesTable theme)
public void ensureThemesTable()
ThemesTable
for the
current Workbook, then creates one and sets it up.
After this, calls to getTheme()
won't give nullpublic void readFrom(InputStream is) throws IOException
is
- The input stream containing the XML document.IOException
- if an error occurs while reading.public String getNumberFormatAt(short fmtId)
getNumberFormatAt
in interface Styles
fmtId
- number format idpublic int putNumberFormat(String fmt)
fmt
in the numberFormats map if the format is not
already in the the number format style table.
Does nothing if fmt
is already in number format style table.putNumberFormat
in interface Styles
fmt
- the number format to add to number format style tablefmt
in the number format style tableIllegalStateException
- if adding the number format to the styles table
would exceed the MAXIMUM_NUMBER_OF_DATA_FORMATS
allowed.public void putNumberFormat(short index, String fmt)
fmt
This may be used to override built-in number formats.putNumberFormat
in interface Styles
index
- the number format IDfmt
- the number format codepublic boolean removeNumberFormat(short index)
removeNumberFormat
in interface Styles
index
- the number format id to removepublic boolean removeNumberFormat(String fmt)
removeNumberFormat
in interface Styles
fmt
- the number format to removepublic int putFont(XSSFFont font, boolean forceRegistration)
XSSFFont.registerTo(StylesTable)
public int putFont(XSSFFont font)
Styles
public XSSFCellStyle getStyleAt(int idx)
getStyleAt
in interface Styles
idx
- style indexpublic int putStyle(XSSFCellStyle style)
public XSSFCellBorder getBorderAt(int idx)
getBorderAt
in interface Styles
public int putBorder(XSSFCellBorder border)
public XSSFCellFill getFillAt(int idx)
public List<XSSFCellBorder> getBorders()
public List<XSSFCellFill> getFills()
public int putFill(XSSFCellFill fill)
@Internal public int putCellXf(CTXf cellXf)
cellXf
- the cell to add to the styles table@Internal public int putCellStyleXf(CTXf cellStyleXf)
cellStyleXf
- the cell style to add to the styles tablepublic int getNumCellStyles()
getNumCellStyles
in interface Styles
public int getNumDataFormats()
getNumDataFormats
in interface Styles
@Internal public int _getStyleXfsSize()
@Internal public CTStylesheet getCTStylesheet()
@Internal public int _getDXfsSize()
public void writeTo(OutputStream out) throws IOException
out
- The stream to write to.IOException
- if an error occurs while writing.@Internal public int putDxf(CTDxf dxf)
dxf
- the Dxf to addpublic TableStyle getExplicitTableStyle(String name)
name
- of the table stylepublic Set<String> getExplicitTableStyleNames()
public TableStyle getTableStyle(String name)
name
- of the table stylepublic XSSFCellStyle createCellStyle()
XSSFWorkbook.createCellStyle()
rather than working with the styles table directly.IllegalStateException
- if the maximum number of cell styles has been reached.public XSSFFont findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
public XSSFFont findFont(boolean bold, Color color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
public IndexedColorMap getIndexedColors()
Copyright © 2010 - 2020 Adobe. All Rights Reserved