public class StylesTable extends POIXMLDocumentPart
Modifier and Type | Field and Description |
---|---|
static int |
FIRST_CUSTOM_STYLE_ID
The first style id available for use as a custom style
|
DEFAULT_XML_OPTIONS
Constructor and Description |
---|
StylesTable()
Create a new, empty StylesTable
|
StylesTable(PackagePart part,
PackageRelationship rel) |
Modifier and Type | Method and Description |
---|---|
int |
_getDXfsSize() |
int |
_getNumberFormatSize()
For unit testing only
|
int |
_getStyleXfsSize()
For unit testing only
|
int |
_getXfsSize()
For unit testing only
|
void |
addTableStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyle tbStyle) |
protected void |
commit()
Save the content in the underlying package part.
|
XSSFCellStyle |
createCellStyle() |
XSSFCellStyle |
createDefaultCellStyle(XSSFCellBorder border,
XSSFCellFill fill,
XSSFFont font,
int numFmtId) |
XSSFFont |
findFont(short boldWeight,
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
|
XSSFFont |
findFont(short boldWeight,
XSSFColor color,
short fontHeight,
String name,
boolean italic,
boolean strikeout,
short typeOffset,
byte underline)
Find a font per the given font.
|
XSSFCellBorder |
getBorderAt(int idx) |
List<XSSFCellBorder> |
getBorders() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle |
getCellStyle(String name) |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle |
getCellStyleByName(String name) |
Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf> |
getCellStyleDxfs() |
Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle> |
getCellStyles() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf |
getCellStyleXfAt(int idx) |
Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf> |
getCellStyleXfs() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf |
getCellXfAt(int idx) |
List<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf> |
getCellXfs() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTStylesheet |
getCTStylesheet()
For unit testing only!
|
String |
getDefaultPivotStyle() |
XSSFFont |
getDefaultStyleFont() |
String |
getDefaultTableStyle() |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf |
getDxfAt(int idx) |
int |
getDxfIndex(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf dxf) |
XSSFCellFill |
getFillAt(int idx) |
List<XSSFCellFill> |
getFills() |
XSSFFont |
getFontAt(int idx) |
List<XSSFFont> |
getFonts() |
String |
getNumberFormatAt(int idx) |
Map<Integer,String> |
getNumberFormats() |
int |
getNumCellStyles()
get the size of cell styles
|
XSSFCellStyle |
getStyleAt(int idx) |
XSSFNamedStyle |
getStyleByName(String name) |
List<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyle> |
getTableStyles() |
ThemesTable |
getTheme() |
int |
putBorder(XSSFCellBorder border) |
int |
putCellStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle style) |
int |
putCellStyleXf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf xf) |
int |
putCellXf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellXf) |
int |
putDxf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf dxf) |
int |
putFill(XSSFCellFill fill) |
int |
putFont(XSSFFont font) |
int |
putFont(XSSFFont font,
boolean forceRegistration)
Records the given font in the font table.
|
int |
putNumberFormat(String fmt) |
int |
putStyle(XSSFCellStyle style) |
protected void |
readFrom(InputStream is)
Read this shared styles table from an XML file.
|
void |
replaceCellStyleXfAt(int idx,
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellStyleXf) |
void |
replaceCellXfAt(int idx,
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellXf) |
void |
setDefaultCellStyle(XSSFCellStyle cellStyle) |
void |
setDefaultPivotStyle(String defaultPivotStyle) |
void |
setDefaultTableStyle(String defaultTableStyle) |
void |
setTheme(ThemesTable theme) |
void |
writeTo(OutputStream out)
Write this table out as XML.
|
addRelation, clearMemoryPackagePart, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationCounter, getRelationId, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString
public static final int FIRST_CUSTOM_STYLE_ID
public StylesTable()
public StylesTable(PackagePart part, PackageRelationship rel) throws IOException
IOException
public ThemesTable getTheme()
public void setTheme(ThemesTable theme)
protected void readFrom(InputStream is) throws IOException
is
- The input stream containing the XML document.IOException
- if an error occurs while reading.public String getNumberFormatAt(int idx)
public int putNumberFormat(String fmt)
public XSSFFont getFontAt(int idx)
public int putFont(XSSFFont font, boolean forceRegistration)
XSSFFont.registerTo(StylesTable)
public int putFont(XSSFFont font)
public XSSFCellStyle getStyleAt(int idx)
public int putStyle(XSSFCellStyle style)
public XSSFCellBorder getBorderAt(int idx)
public int putBorder(XSSFCellBorder border)
public XSSFCellFill getFillAt(int idx)
public List<XSSFCellBorder> getBorders()
public List<XSSFCellFill> getFills()
public int putFill(XSSFCellFill fill)
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf getCellXfAt(int idx)
public int putCellXf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellXf)
public void replaceCellXfAt(int idx, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellXf)
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf getCellStyleXfAt(int idx)
public void replaceCellStyleXfAt(int idx, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf cellStyleXf)
public int getNumCellStyles()
public int _getNumberFormatSize()
public int _getXfsSize()
public int _getStyleXfsSize()
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTStylesheet getCTStylesheet()
public int _getDXfsSize()
public void writeTo(OutputStream out) throws IOException
out
- The stream to write to.IOException
- if an error occurs while writing.protected void commit() throws IOException
POIXMLDocumentPart
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
out.close();
}
commit
in class POIXMLDocumentPart
IOException
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf getDxfAt(int idx)
public int putDxf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf dxf)
public XSSFCellStyle createCellStyle()
public XSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
public XSSFFont findFont(short boldWeight, XSSFColor color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
public void setDefaultCellStyle(XSSFCellStyle cellStyle)
public int putCellStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle style)
public int putCellStyleXf(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf xf)
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle getCellStyleByName(String name)
public Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf> getCellStyleXfs()
public Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle> getCellStyles()
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle getCellStyle(String name)
public XSSFNamedStyle getStyleByName(String name)
public Collection<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf> getCellStyleDxfs()
public XSSFCellStyle createDefaultCellStyle(XSSFCellBorder border, XSSFCellFill fill, XSSFFont font, int numFmtId)
public List<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf> getCellXfs()
public XSSFFont getDefaultStyleFont()
public List<org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyle> getTableStyles()
public String getDefaultPivotStyle()
public String getDefaultTableStyle()
public void setDefaultPivotStyle(String defaultPivotStyle)
public void setDefaultTableStyle(String defaultTableStyle)
public int getDxfIndex(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf dxf)
public void addTableStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyle tbStyle)
Copyright © 2020. All rights reserved.