|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.xssf.usermodel.XSSFCellStyle
public class XSSFCellStyle
High level representation of the the possible formatting information for the contents of the cells on a sheet in a SpreadsheetML document.
XSSFWorkbook.createCellStyle(),
XSSFWorkbook.getCellStyleAt(int),
XSSFCell.setCellStyle(org.apache.poi.ss.usermodel.CellStyle)| Constructor Summary | |
|---|---|
XSSFCellStyle(int cellXfId,
int cellStyleXfId,
StylesTable stylesSource,
ThemesTable theme)
Creates a Cell Style from the supplied parts |
|
XSSFCellStyle(StylesTable stylesSource)
Creates an empty Cell Style |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Make a copy of this style. |
void |
cloneStyleFrom(CellStyle source)
Clones all the style information from another XSSFCellStyle, onto this one. |
boolean |
equals(java.lang.Object o)
Checks is the supplied style is equal to this style |
short |
getAlignment()
Deprecated. POI 3.15 beta 3. Use getAlignmentEnum() instead. |
HorizontalAlignment |
getAlignmentEnum()
Get the type of horizontal alignment for the cell |
short |
getBorderBottom()
Deprecated. 3.15 beta 2. Use getBorderBottomEnum() |
BorderStyle |
getBorderBottomEnum()
Get the type of border to use for the bottom border of the cell Will be removed when getBorderBottom() returns a BorderStyle enum |
XSSFColor |
getBorderColor(XSSFCellBorder.BorderSide side)
Gets border color |
short |
getBorderLeft()
Deprecated. 3.15 beta 2. Use getBorderLeftEnum() |
BorderStyle |
getBorderLeftEnum()
Get the type of border to use for the left border of the cell Will be removed when getBorderLeft() returns a BorderStyle enum |
short |
getBorderRight()
Deprecated. 3.15 beta 2. Use getBorderRightEnum() instead |
BorderStyle |
getBorderRightEnum()
Get the type of border to use for the right border of the cell Will be removed when getBorderRight() returns a BorderStyle enum |
short |
getBorderTop()
Deprecated. 3.15 beta 2. Use getBorderTopEnum() instead. |
BorderStyle |
getBorderTopEnum()
Get the type of border to use for the top border of the cell Will be removed when getBorderTop() returns a BorderStyle enum |
short |
getBottomBorderColor()
Get the color to use for the bottom border Color is optional. |
XSSFColor |
getBottomBorderXSSFColor()
Get the color to use for the bottom border as a XSSFColor |
protected XSSFCellAlignment |
getCellAlignment()
get the cellAlignment object to use for manage alignment |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf |
getCoreXf()
Used so that StylesSource can figure out our location |
short |
getDataFormat()
Get the index of the number format (numFmt) record used by this cell format. |
java.lang.String |
getDataFormatString()
Get the contents of the format string, by looking up the StylesSource |
short |
getFillBackgroundColor()
Get the background fill color. |
XSSFColor |
getFillBackgroundColorColor()
Gets the color object representing the current background fill, resolving indexes using the supplied workbook. |
XSSFColor |
getFillBackgroundXSSFColor()
Get the background fill color. |
short |
getFillForegroundColor()
Get the foreground fill color. |
XSSFColor |
getFillForegroundColorColor()
Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook. |
XSSFColor |
getFillForegroundXSSFColor()
Get the foreground fill color. |
short |
getFillPattern()
Deprecated. POI 3.15 beta 3. This method will return FillPatternType in the future. Use setFillPattern(FillPatternType) instead. |
FillPatternType |
getFillPatternEnum()
Get the fill pattern |
XSSFFont |
getFont()
Gets the font for this style |
short |
getFontIndex()
Gets the index of the font for this style |
boolean |
getHidden()
Get whether the cell's using this style are to be hidden |
short |
getIndention()
Get the number of spaces to indent the text in the cell |
short |
getIndex()
Get the index within the StylesTable (sequence within the collection of CTXf elements) |
short |
getLeftBorderColor()
Get the color to use for the left border |
XSSFColor |
getLeftBorderXSSFColor()
Get the color to use for the left border |
boolean |
getLocked()
Get whether the cell's using this style are locked |
boolean |
getQuotePrefixed()
Is "Quote Prefix" or "123 Prefix" enabled for the cell? |
short |
getRightBorderColor()
Get the color to use for the right border |
XSSFColor |
getRightBorderXSSFColor()
Get the color to use for the right border |
short |
getRotation()
Get the degree of rotation for the text in the cell |
boolean |
getShrinkToFit()
Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long? |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf |
getStyleXf()
Used so that StylesSource can figure out our location |
short |
getTopBorderColor()
Get the color to use for the top border |
XSSFColor |
getTopBorderXSSFColor()
Get the color to use for the top border |
protected int |
getUIndex()
Workaround for places where we need to support more than 32767 cell styles, ideally the main getIndex() and others would return int, not short, but that would affect some public APIs |
short |
getVerticalAlignment()
Deprecated. POI 3.15 beta 3. Use getVerticalAlignmentEnum() instead. |
VerticalAlignment |
getVerticalAlignmentEnum()
Get the type of vertical alignment for the cell |
boolean |
getWrapText()
Whether the text should be wrapped |
int |
hashCode()
Returns a hash code value for the object. |
void |
setAlignment(HorizontalAlignment align)
Set the type of horizontal alignment for the cell |
void |
setBorderBottom(BorderStyle border)
Set the type of border to use for the bottom border of the cell |
void |
setBorderColor(XSSFCellBorder.BorderSide side,
XSSFColor color)
Set the color to use for the selected border |
void |
setBorderLeft(BorderStyle border)
Set the type of border to use for the left border of the cell |
void |
setBorderRight(BorderStyle border)
Set the type of border to use for the right border of the cell |
void |
setBorderTop(BorderStyle border)
Set the type of border to use for the top border of the cell |
void |
setBottomBorderColor(short color)
Set the color to use for the bottom border |
void |
setBottomBorderColor(XSSFColor color)
Set the color to use for the bottom border |
void |
setDataFormat(int fmt)
Set the index of a data format |
void |
setDataFormat(short fmt)
Set the index of a data format |
void |
setFillBackgroundColor(short bg)
Set the background fill color represented as a indexed color value. |
void |
setFillBackgroundColor(XSSFColor color)
Set the background fill color represented as a XSSFColor value. |
void |
setFillForegroundColor(short fg)
Set the foreground fill color as a indexed color value Note: Ensure Foreground color is set prior to background color. |
void |
setFillForegroundColor(XSSFColor color)
Set the foreground fill color represented as a XSSFColor value. |
void |
setFillPattern(FillPatternType pattern)
This element is used to specify cell fill information for pattern and solid color cell fills. |
void |
setFont(Font font)
Set the font for this style |
void |
setHidden(boolean hidden)
Set the cell's using this style to be hidden |
void |
setIndention(short indent)
Set the number of spaces to indent the text in the cell |
void |
setLeftBorderColor(short color)
Set the color to use for the left border as a indexed color value |
void |
setLeftBorderColor(XSSFColor color)
Set the color to use for the left border as a XSSFColor value |
void |
setLocked(boolean locked)
Set the cell's using this style to be locked |
void |
setQuotePrefixed(boolean quotePrefix)
Turn on or off "Quote Prefix" or "123 Prefix" for the style, which is used to tell Excel that the thing which looks like a number or a formula shouldn't be treated as on. |
void |
setRightBorderColor(short color)
Set the color to use for the right border |
void |
setRightBorderColor(XSSFColor color)
Set the color to use for the right border as a XSSFColor value |
void |
setRotation(short rotation)
Set the degree of rotation for the text in the cell |
void |
setShrinkToFit(boolean shrinkToFit)
Controls if the Cell should be auto-sized to shrink to fit if the text is too long |
void |
setTopBorderColor(short color)
Set the color to use for the top border |
void |
setTopBorderColor(XSSFColor color)
Set the color to use for the top border as a XSSFColor value |
void |
setVerticalAlignment(VerticalAlignment align)
Set the type of vertical alignment for the cell |
void |
setWrapText(boolean wrapped)
Set whether the text should be wrapped. |
void |
verifyBelongsToStylesSource(StylesTable src)
Verifies that this style belongs to the supplied Workbook Styles Source. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XSSFCellStyle(int cellXfId,
int cellStyleXfId,
StylesTable stylesSource,
ThemesTable theme)
cellXfId - The main XF for the cell. Must be a valid 0-based index into the XF tablecellStyleXfId - Optional, style xf. A value of -1 means no xf.stylesSource - Styles Source to work offpublic XSSFCellStyle(StylesTable stylesSource)
| Method Detail |
|---|
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf getCoreXf()
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf getStyleXf()
public void verifyBelongsToStylesSource(StylesTable src)
java.lang.IllegalArgumentException - if there's a workbook mis-matchpublic void cloneStyleFrom(CellStyle source)
cloneStyleFrom in interface CellStylepublic short getAlignment()
getAlignmentEnum() instead.
getAlignment in interface CellStylepublic HorizontalAlignment getAlignmentEnum()
getAlignmentEnum in interface CellStylepublic BorderStyle getBorderBottomEnum()
getBorderBottom() returns a BorderStyle enum
getBorderBottomEnum in interface CellStyleBorderStyle.NONEpublic short getBorderBottom()
getBorderBottomEnum()
getBorderBottom in interface CellStylepublic BorderStyle getBorderLeftEnum()
getBorderLeft() returns a BorderStyle enum
getBorderLeftEnum in interface CellStyleBorderStyle.NONEpublic short getBorderLeft()
getBorderLeftEnum()
getBorderLeft in interface CellStylepublic BorderStyle getBorderRightEnum()
getBorderRight() returns a BorderStyle enum
getBorderRightEnum in interface CellStyleBorderStyle.NONEpublic short getBorderRight()
getBorderRightEnum() instead
getBorderRight in interface CellStyleBorderStyle.NONEpublic BorderStyle getBorderTopEnum()
getBorderTop() returns a BorderStyle enum
getBorderTopEnum in interface CellStyleBorderStyle.NONEpublic short getBorderTop()
getBorderTopEnum() instead.
getBorderTop in interface CellStyleBorderStyle.NONEpublic short getBottomBorderColor()
getBottomBorderColor in interface CellStyleIndexedColors.AUTOMATICIndexedColorspublic XSSFColor getBottomBorderXSSFColor()
XSSFColor
null if not setpublic short getDataFormat()
getDataFormat in interface CellStyleDataFormatpublic java.lang.String getDataFormatString()
getDataFormatString in interface CellStylepublic short getFillBackgroundColor()
Note - many cells are actually filled with a foreground
fill, not a background fill - see getFillForegroundColor()
getFillBackgroundColor in interface CellStyleIndexedColors.AUTOMATICIndexedColorspublic XSSFColor getFillBackgroundColorColor()
CellStyle
getFillBackgroundColorColor in interface CellStylepublic XSSFColor getFillBackgroundXSSFColor()
Note - many cells are actually filled with a foreground
fill, not a background fill - see getFillForegroundColor()
null if not setXSSFColor.getRGB()public short getFillForegroundColor()
Many cells are filled with this, instead of a
background color (getFillBackgroundColor())
getFillForegroundColor in interface CellStyleIndexedColors.AUTOMATICIndexedColorspublic XSSFColor getFillForegroundColorColor()
CellStyle
getFillForegroundColorColor in interface CellStylepublic XSSFColor getFillForegroundXSSFColor()
null if not setpublic short getFillPattern()
FillPatternType in the future. Use setFillPattern(FillPatternType) instead.
getFillPattern in interface CellStyleFillPatternType.NO_FILLpublic FillPatternType getFillPatternEnum()
getFillPatternEnum in interface CellStyleFillPatternType.NO_FILLpublic XSSFFont getFont()
public short getFontIndex()
getFontIndex in interface CellStyleXSSFWorkbook.getFontAt(short)public boolean getHidden()
getHidden in interface CellStylepublic short getIndention()
getIndention in interface CellStylepublic short getIndex()
getIndex in interface CellStyleprotected int getUIndex()
public short getLeftBorderColor()
getLeftBorderColor in interface CellStyleIndexedColors.BLACKIndexedColorspublic XSSFColor getLeftBorderXSSFColor()
null if not setIndexedColorspublic boolean getLocked()
getLocked in interface CellStylepublic boolean getQuotePrefixed()
getQuotePrefixed in interface CellStylepublic short getRightBorderColor()
getRightBorderColor in interface CellStyleIndexedColors.BLACKIndexedColorspublic XSSFColor getRightBorderXSSFColor()
null if not setpublic short getRotation()
Expressed in degrees. Values range from 0 to 180. The first letter of
the text is considered the center-point of the arc.
For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the
horizon is calculated as:
[degrees below horizon] = 90 - textRotation.
getRotation in interface CellStylepublic boolean getShrinkToFit()
CellStyle
getShrinkToFit in interface CellStylepublic short getTopBorderColor()
getTopBorderColor in interface CellStyleIndexedColors.BLACKIndexedColorspublic XSSFColor getTopBorderXSSFColor()
null if not setpublic short getVerticalAlignment()
getVerticalAlignmentEnum() instead.
getVerticalAlignment in interface CellStyleVerticalAlignmentpublic VerticalAlignment getVerticalAlignmentEnum()
getVerticalAlignmentEnum in interface CellStyleVerticalAlignment.BOTTOMpublic boolean getWrapText()
getWrapText in interface CellStylepublic void setAlignment(HorizontalAlignment align)
setAlignment in interface CellStylealign - - the type of alignmentpublic void setBorderBottom(BorderStyle border)
setBorderBottom in interface CellStyleborder - - type of border to useBorderStylepublic void setBorderLeft(BorderStyle border)
setBorderLeft in interface CellStyleborder - the type of border to usepublic void setBorderRight(BorderStyle border)
setBorderRight in interface CellStyleborder - the type of border to usepublic void setBorderTop(BorderStyle border)
setBorderTop in interface CellStyleborder - the type of border to usepublic void setBottomBorderColor(short color)
setBottomBorderColor in interface CellStylecolor - the index of the color definitionIndexedColorspublic void setBottomBorderColor(XSSFColor color)
color - the color to use, null means no colorpublic void setDataFormat(short fmt)
setDataFormat in interface CellStylefmt - the index of a data formatDataFormatpublic void setDataFormat(int fmt)
fmt - the index of a data formatpublic void setFillBackgroundColor(XSSFColor color)
XSSFColor value.
For example:
cs.setFillPattern(XSSFCellStyle.FINE_DOTS ); cs.setFillBackgroundXSSFColor(new XSSFColor(java.awt.Color.RED));optionally a Foreground and background fill can be applied: Note: Ensure Foreground color is set prior to background
cs.setFillPattern(XSSFCellStyle.FINE_DOTS ); cs.setFillForegroundColor(new XSSFColor(java.awt.Color.BLUE)); cs.setFillBackgroundColor(new XSSFColor(java.awt.Color.GREEN));or, for the special case of SOLID_FILL:
cs.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND ); cs.setFillForegroundColor(new XSSFColor(java.awt.Color.GREEN));It is necessary to set the fill style in order for the color to be shown in the cell.
color - - the color to usepublic void setFillBackgroundColor(short bg)
For example:
cs.setFillPattern(XSSFCellStyle.FINE_DOTS ); cs.setFillBackgroundXSSFColor(IndexedColors.RED.getIndex());optionally a Foreground and background fill can be applied: Note: Ensure Foreground color is set prior to background
cs.setFillPattern(XSSFCellStyle.FINE_DOTS ); cs.setFillForegroundColor(IndexedColors.BLUE.getIndex()); cs.setFillBackgroundColor(IndexedColors.RED.getIndex());or, for the special case of SOLID_FILL:
cs.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND ); cs.setFillForegroundColor(IndexedColors.RED.getIndex());It is necessary to set the fill style in order for the color to be shown in the cell.
setFillBackgroundColor in interface CellStylebg - - the color to useIndexedColorspublic void setFillForegroundColor(XSSFColor color)
XSSFColor value.
color - the color to use)public void setFillForegroundColor(short fg)
setFillForegroundColor in interface CellStylefg - the color to useIndexedColorspublic void setFillPattern(FillPatternType pattern)
setFillPattern in interface CellStylepattern - the fill pattern to usesetFillBackgroundColor(XSSFColor),
setFillForegroundColor(XSSFColor),
FillPatternTypepublic void setFont(Font font)
setFont in interface CellStylefont - a font object created or retrieved from the XSSFWorkbook objectXSSFWorkbook.createFont(),
XSSFWorkbook.getFontAt(short)public void setHidden(boolean hidden)
setHidden in interface CellStylehidden - - whether the cell using this style should be hiddenpublic void setIndention(short indent)
setIndention in interface CellStyleindent - - number of spacespublic void setLeftBorderColor(short color)
setLeftBorderColor in interface CellStylecolor - the index of the color definitionIndexedColorspublic void setLeftBorderColor(XSSFColor color)
XSSFColor value
color - the color to usepublic void setLocked(boolean locked)
setLocked in interface CellStylelocked - - whether the cell using this style should be lockedpublic void setQuotePrefixed(boolean quotePrefix)
setQuotePrefixed in interface CellStylepublic void setRightBorderColor(short color)
setRightBorderColor in interface CellStylecolor - the index of the color definitionIndexedColorspublic void setRightBorderColor(XSSFColor color)
XSSFColor value
color - the color to usepublic void setRotation(short rotation)
Expressed in degrees. Values range from 0 to 180. The first letter of
the text is considered the center-point of the arc.
For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the
horizon is calculated as:
[degrees below horizon] = 90 - textRotation.
setRotation in interface CellStylerotation - - the rotation degrees (between 0 and 180 degrees)public void setTopBorderColor(short color)
setTopBorderColor in interface CellStylecolor - the index of the color definitionIndexedColorspublic void setTopBorderColor(XSSFColor color)
XSSFColor value
color - the color to usepublic void setVerticalAlignment(VerticalAlignment align)
setVerticalAlignment in interface CellStylealign - - the type of alignmentpublic void setWrapText(boolean wrapped)
Setting this flag to true make all content visible
whithin a cell by displaying it on multiple lines
setWrapText in interface CellStylewrapped - a boolean value indicating if the text in a cell should be line-wrapped within the cell.public XSSFColor getBorderColor(XSSFCellBorder.BorderSide side)
side - the border side
public void setBorderColor(XSSFCellBorder.BorderSide side,
XSSFColor color)
side - - where to apply the color definitioncolor - - the color to usepublic void setShrinkToFit(boolean shrinkToFit)
CellStyle
setShrinkToFit in interface CellStyleprotected XSSFCellAlignment getCellAlignment()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the style to check
public java.lang.Object clone()
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||