org.apache.poi.ss.usermodel
Interface CellStyle
-
- All Known Implementing Classes:
- HSSFCellStyle, XSSFCellStyle
public interface CellStyle
-
-
Field Summary
Fields Modifier and Type Field and Description static shortALIGN_CENTERcenter horizontal alignmentstatic shortALIGN_CENTER_SELECTIONcenter-selection? horizontal alignmentstatic shortALIGN_FILLfill? horizontal alignmentstatic shortALIGN_GENERALgeneral (normal) horizontal alignmentstatic shortALIGN_JUSTIFYjustified horizontal alignmentstatic shortALIGN_LEFTleft-justified horizontal alignmentstatic shortALIGN_RIGHTright-justified horizontal alignmentstatic shortALT_BARSWide dotsstatic shortBIG_SPOTSLarge spotsstatic shortBORDER_DASH_DOTdash-dot borderstatic shortBORDER_DASH_DOT_DOTdash-dot-dot borderstatic shortBORDER_DASHEDdash borderstatic shortBORDER_DOTTEDhair-line borderstatic shortBORDER_DOUBLEdouble-line borderstatic shortBORDER_HAIRdot borderstatic shortBORDER_MEDIUMMedium borderstatic shortBORDER_MEDIUM_DASH_DOTmedium dash-dot borderstatic shortBORDER_MEDIUM_DASH_DOT_DOTmedium dash-dot-dot borderstatic shortBORDER_MEDIUM_DASHEDMedium dashed borderstatic shortBORDER_NONENo borderstatic shortBORDER_SLANTED_DASH_DOTslanted dash-dot borderstatic shortBORDER_THICKThick borderstatic shortBORDER_THINThin borderstatic shortBRICKSBrick-like layoutstatic shortDIAMONDSDiamondsstatic shortFINE_DOTSSmall fine dotsstatic shortLEAST_DOTSLeast Dotsstatic shortLESS_DOTSLess Dotsstatic shortNO_FILLNo backgroundstatic shortSOLID_FOREGROUNDSolidly filledstatic shortSPARSE_DOTSSparse dotsstatic shortSQUARESSquaresstatic shortTHICK_BACKWARD_DIAGThick backward facing diagonalsstatic shortTHICK_FORWARD_DIAGThick forward facing diagonalsstatic shortTHICK_HORZ_BANDSThick horizontal bandsstatic shortTHICK_VERT_BANDSThick vertical bandsstatic shortTHIN_BACKWARD_DIAGThin backward diagonalstatic shortTHIN_FORWARD_DIAGThin forward diagonalstatic shortTHIN_HORZ_BANDSThin horizontal bandsstatic shortTHIN_VERT_BANDSThin vertical bandsstatic shortVERTICAL_BOTTOMbottom-aligned vertical alignmentstatic shortVERTICAL_CENTERcenter-aligned vertical alignmentstatic shortVERTICAL_JUSTIFYvertically justified vertical alignmentstatic shortVERTICAL_TOPtop-aligned vertical alignment
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidcloneStyleFrom(CellStyle source)Clones all the style information from another CellStyle, onto this one.shortgetAlignment()get the type of horizontal alignment for the cellshortgetBorderBottom()get the type of border to use for the bottom border of the cellshortgetBorderLeft()get the type of border to use for the left border of the cellshortgetBorderRight()get the type of border to use for the right border of the cellshortgetBorderTop()get the type of border to use for the top border of the cellshortgetBottomBorderColor()get the color to use for the left bordershortgetDataFormat()get the index of the formatjava.lang.StringgetDataFormatString()Get the format stringshortgetFillBackgroundColor()get the background fill color, if the fill is defined with an indexed color.ColorgetFillBackgroundColorColor()Gets the color object representing the current background fill, resolving indexes using the supplied workbook.shortgetFillForegroundColor()get the foreground fill color, if the fill is defined with an indexed color.ColorgetFillForegroundColorColor()Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook.shortgetFillPattern()get the fill pattern (??) - set to 1 to fill with foreground colorshortgetFontIndex()gets the index of the font for this stylebooleangetHidden()get whether the cell's using this style are to be hiddenshortgetIndention()get the number of spaces to indent the text in the cellshortgetIndex()get the index within the Workbook (sequence within the collection of ExtnededFormat objects)shortgetLeftBorderColor()get the color to use for the left borderbooleangetLocked()get whether the cell's using this style are to be lockedshortgetRightBorderColor()get the color to use for the left bordershortgetRotation()get the degree of rotation for the text in the cellbooleangetShrinkToFit()Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long?shortgetTopBorderColor()get the color to use for the top bordershortgetVerticalAlignment()get the type of vertical alignment for the cellbooleangetWrapText()get whether the text should be wrappedvoidsetAlignment(short align)set the type of horizontal alignment for the cellvoidsetBorderBottom(short border)set the type of border to use for the bottom border of the cellvoidsetBorderLeft(short border)set the type of border to use for the left border of the cellvoidsetBorderRight(short border)set the type of border to use for the right border of the cellvoidsetBorderTop(short border)set the type of border to use for the top border of the cellvoidsetBottomBorderColor(short color)set the color to use for the bottom bordervoidsetDataFormat(short fmt)set the data format (must be a valid format)voidsetFillBackgroundColor(short bg)set the background fill color.voidsetFillForegroundColor(short bg)set the foreground fill color Note: Ensure Foreground color is set prior to background color.voidsetFillPattern(short fp)setting to one fills the cell with the foreground color...voidsetFont(Font font)set the font for this stylevoidsetHidden(boolean hidden)set the cell's using this style to be hiddenvoidsetIndention(short indent)set the number of spaces to indent the text in the cellvoidsetLeftBorderColor(short color)set the color to use for the left bordervoidsetLocked(boolean locked)set the cell's using this style to be lockedvoidsetRightBorderColor(short color)set the color to use for the right bordervoidsetRotation(short rotation)set the degree of rotation for the text in the cellvoidsetShrinkToFit(boolean shrinkToFit)Controls if the Cell should be auto-sized to shrink to fit if the text is too longvoidsetTopBorderColor(short color)set the color to use for the top bordervoidsetVerticalAlignment(short align)set the type of vertical alignment for the cellvoidsetWrapText(boolean wrapped)Set whether the text should be wrapped.
-
-
-
Field Detail
-
ALIGN_GENERAL
static final short ALIGN_GENERAL
general (normal) horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_LEFT
static final short ALIGN_LEFT
left-justified horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_CENTER
static final short ALIGN_CENTER
center horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_RIGHT
static final short ALIGN_RIGHT
right-justified horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_FILL
static final short ALIGN_FILL
fill? horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_JUSTIFY
static final short ALIGN_JUSTIFY
justified horizontal alignment- See Also:
- Constant Field Values
-
ALIGN_CENTER_SELECTION
static final short ALIGN_CENTER_SELECTION
center-selection? horizontal alignment- See Also:
- Constant Field Values
-
VERTICAL_TOP
static final short VERTICAL_TOP
top-aligned vertical alignment- See Also:
- Constant Field Values
-
VERTICAL_CENTER
static final short VERTICAL_CENTER
center-aligned vertical alignment- See Also:
- Constant Field Values
-
VERTICAL_BOTTOM
static final short VERTICAL_BOTTOM
bottom-aligned vertical alignment- See Also:
- Constant Field Values
-
VERTICAL_JUSTIFY
static final short VERTICAL_JUSTIFY
vertically justified vertical alignment- See Also:
- Constant Field Values
-
BORDER_NONE
static final short BORDER_NONE
No border- See Also:
- Constant Field Values
-
BORDER_THIN
static final short BORDER_THIN
Thin border- See Also:
- Constant Field Values
-
BORDER_MEDIUM
static final short BORDER_MEDIUM
Medium border- See Also:
- Constant Field Values
-
BORDER_DASHED
static final short BORDER_DASHED
dash border- See Also:
- Constant Field Values
-
BORDER_HAIR
static final short BORDER_HAIR
dot border- See Also:
- Constant Field Values
-
BORDER_THICK
static final short BORDER_THICK
Thick border- See Also:
- Constant Field Values
-
BORDER_DOUBLE
static final short BORDER_DOUBLE
double-line border- See Also:
- Constant Field Values
-
BORDER_DOTTED
static final short BORDER_DOTTED
hair-line border- See Also:
- Constant Field Values
-
BORDER_MEDIUM_DASHED
static final short BORDER_MEDIUM_DASHED
Medium dashed border- See Also:
- Constant Field Values
-
BORDER_DASH_DOT
static final short BORDER_DASH_DOT
dash-dot border- See Also:
- Constant Field Values
-
BORDER_MEDIUM_DASH_DOT
static final short BORDER_MEDIUM_DASH_DOT
medium dash-dot border- See Also:
- Constant Field Values
-
BORDER_DASH_DOT_DOT
static final short BORDER_DASH_DOT_DOT
dash-dot-dot border- See Also:
- Constant Field Values
-
BORDER_MEDIUM_DASH_DOT_DOT
static final short BORDER_MEDIUM_DASH_DOT_DOT
medium dash-dot-dot border- See Also:
- Constant Field Values
-
BORDER_SLANTED_DASH_DOT
static final short BORDER_SLANTED_DASH_DOT
slanted dash-dot border- See Also:
- Constant Field Values
-
NO_FILL
static final short NO_FILL
No background- See Also:
- Constant Field Values
-
SOLID_FOREGROUND
static final short SOLID_FOREGROUND
Solidly filled- See Also:
- Constant Field Values
-
FINE_DOTS
static final short FINE_DOTS
Small fine dots- See Also:
- Constant Field Values
-
ALT_BARS
static final short ALT_BARS
Wide dots- See Also:
- Constant Field Values
-
SPARSE_DOTS
static final short SPARSE_DOTS
Sparse dots- See Also:
- Constant Field Values
-
THICK_HORZ_BANDS
static final short THICK_HORZ_BANDS
Thick horizontal bands- See Also:
- Constant Field Values
-
THICK_VERT_BANDS
static final short THICK_VERT_BANDS
Thick vertical bands- See Also:
- Constant Field Values
-
THICK_BACKWARD_DIAG
static final short THICK_BACKWARD_DIAG
Thick backward facing diagonals- See Also:
- Constant Field Values
-
THICK_FORWARD_DIAG
static final short THICK_FORWARD_DIAG
Thick forward facing diagonals- See Also:
- Constant Field Values
-
BIG_SPOTS
static final short BIG_SPOTS
Large spots- See Also:
- Constant Field Values
-
BRICKS
static final short BRICKS
Brick-like layout- See Also:
- Constant Field Values
-
THIN_HORZ_BANDS
static final short THIN_HORZ_BANDS
Thin horizontal bands- See Also:
- Constant Field Values
-
THIN_VERT_BANDS
static final short THIN_VERT_BANDS
Thin vertical bands- See Also:
- Constant Field Values
-
THIN_BACKWARD_DIAG
static final short THIN_BACKWARD_DIAG
Thin backward diagonal- See Also:
- Constant Field Values
-
THIN_FORWARD_DIAG
static final short THIN_FORWARD_DIAG
Thin forward diagonal- See Also:
- Constant Field Values
-
SQUARES
static final short SQUARES
Squares- See Also:
- Constant Field Values
-
DIAMONDS
static final short DIAMONDS
Diamonds- See Also:
- Constant Field Values
-
LESS_DOTS
static final short LESS_DOTS
Less Dots- See Also:
- Constant Field Values
-
LEAST_DOTS
static final short LEAST_DOTS
Least Dots- See Also:
- Constant Field Values
-
-
Method Detail
-
getIndex
short getIndex()
get the index within the Workbook (sequence within the collection of ExtnededFormat objects)- Returns:
- unique index number of the underlying record this style represents (probably you don't care unless you're comparing which one is which)
-
setDataFormat
void setDataFormat(short fmt)
set the data format (must be a valid format)- See Also:
DataFormat
-
getDataFormat
short getDataFormat()
get the index of the format- See Also:
DataFormat
-
getDataFormatString
java.lang.String getDataFormatString()
Get the format string
-
setFont
void setFont(Font font)
set the font for this style- Parameters:
font- a font object created or retreived from the Workbook object- See Also:
Workbook.createFont(),Workbook.getFontAt(short)
-
getFontIndex
short getFontIndex()
gets the index of the font for this style- See Also:
Workbook.getFontAt(short)
-
setHidden
void setHidden(boolean hidden)
set the cell's using this style to be hidden- Parameters:
hidden- - whether the cell using this style should be hidden
-
getHidden
boolean getHidden()
get whether the cell's using this style are to be hidden- Returns:
- hidden - whether the cell using this style should be hidden
-
setLocked
void setLocked(boolean locked)
set the cell's using this style to be locked- Parameters:
locked- - whether the cell using this style should be locked
-
getLocked
boolean getLocked()
get whether the cell's using this style are to be locked- Returns:
- hidden - whether the cell using this style should be locked
-
setAlignment
void setAlignment(short align)
set the type of horizontal alignment for the cell- Parameters:
align- - the type of alignment- See Also:
ALIGN_GENERAL,ALIGN_LEFT,ALIGN_CENTER,ALIGN_RIGHT,ALIGN_FILL,ALIGN_JUSTIFY,ALIGN_CENTER_SELECTION
-
getAlignment
short getAlignment()
get the type of horizontal alignment for the cell- Returns:
- align - the type of alignment
- See Also:
ALIGN_GENERAL,ALIGN_LEFT,ALIGN_CENTER,ALIGN_RIGHT,ALIGN_FILL,ALIGN_JUSTIFY,ALIGN_CENTER_SELECTION
-
setWrapText
void setWrapText(boolean wrapped)
Set whether the text should be wrapped. Setting this flag totruemake all content visible whithin a cell by displaying it on multiple lines- Parameters:
wrapped- wrap text or not
-
getWrapText
boolean getWrapText()
get whether the text should be wrapped- Returns:
- wrap text or not
-
setVerticalAlignment
void setVerticalAlignment(short align)
set the type of vertical alignment for the cell- Parameters:
align- the type of alignment- See Also:
VERTICAL_TOP,VERTICAL_CENTER,VERTICAL_BOTTOM,VERTICAL_JUSTIFY
-
getVerticalAlignment
short getVerticalAlignment()
get the type of vertical alignment for the cell- Returns:
- align the type of alignment
- See Also:
VERTICAL_TOP,VERTICAL_CENTER,VERTICAL_BOTTOM,VERTICAL_JUSTIFY
-
setRotation
void setRotation(short rotation)
set the degree of rotation for the text in the cell- Parameters:
rotation- degrees (between -90 and 90 degrees)
-
getRotation
short getRotation()
get the degree of rotation for the text in the cell- Returns:
- rotation degrees (between -90 and 90 degrees)
-
setIndention
void setIndention(short indent)
set the number of spaces to indent the text in the cell- Parameters:
indent- - number of spaces
-
getIndention
short getIndention()
get the number of spaces to indent the text in the cell- Returns:
- indent - number of spaces
-
setBorderLeft
void setBorderLeft(short border)
set the type of border to use for the left border of the cell- Parameters:
border- type- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
getBorderLeft
short getBorderLeft()
get the type of border to use for the left border of the cell- Returns:
- border type
- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
setBorderRight
void setBorderRight(short border)
set the type of border to use for the right border of the cell- Parameters:
border- type- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
getBorderRight
short getBorderRight()
get the type of border to use for the right border of the cell- Returns:
- border type
- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
setBorderTop
void setBorderTop(short border)
set the type of border to use for the top border of the cell- Parameters:
border- type- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
getBorderTop
short getBorderTop()
get the type of border to use for the top border of the cell- Returns:
- border type
- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
setBorderBottom
void setBorderBottom(short border)
set the type of border to use for the bottom border of the cell- Parameters:
border- type- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
getBorderBottom
short getBorderBottom()
get the type of border to use for the bottom border of the cell- Returns:
- border type
- See Also:
BORDER_NONE,BORDER_THIN,BORDER_MEDIUM,BORDER_DASHED,BORDER_DOTTED,BORDER_THICK,BORDER_DOUBLE,BORDER_HAIR,BORDER_MEDIUM_DASHED,BORDER_DASH_DOT,BORDER_MEDIUM_DASH_DOT,BORDER_DASH_DOT_DOT,BORDER_MEDIUM_DASH_DOT_DOT,BORDER_SLANTED_DASH_DOT
-
setLeftBorderColor
void setLeftBorderColor(short color)
set the color to use for the left border- Parameters:
color- The index of the color definition
-
getLeftBorderColor
short getLeftBorderColor()
get the color to use for the left border
-
setRightBorderColor
void setRightBorderColor(short color)
set the color to use for the right border- Parameters:
color- The index of the color definition
-
getRightBorderColor
short getRightBorderColor()
get the color to use for the left border- Returns:
- the index of the color definition
-
setTopBorderColor
void setTopBorderColor(short color)
set the color to use for the top border- Parameters:
color- The index of the color definition
-
getTopBorderColor
short getTopBorderColor()
get the color to use for the top border- Returns:
- hhe index of the color definition
-
setBottomBorderColor
void setBottomBorderColor(short color)
set the color to use for the bottom border- Parameters:
color- The index of the color definition
-
getBottomBorderColor
short getBottomBorderColor()
get the color to use for the left border- Returns:
- the index of the color definition
-
setFillPattern
void setFillPattern(short fp)
setting to one fills the cell with the foreground color... No idea about other values- Parameters:
fp- fill pattern (set to 1 to fill w/foreground color)- See Also:
NO_FILL,SOLID_FOREGROUND,FINE_DOTS,ALT_BARS,SPARSE_DOTS,THICK_HORZ_BANDS,THICK_VERT_BANDS,THICK_BACKWARD_DIAG,THICK_FORWARD_DIAG,BIG_SPOTS,BRICKS,THIN_HORZ_BANDS,THIN_VERT_BANDS,THIN_BACKWARD_DIAG,THIN_FORWARD_DIAG,SQUARES,DIAMONDS
-
getFillPattern
short getFillPattern()
get the fill pattern (??) - set to 1 to fill with foreground color- Returns:
- fill pattern
-
setFillBackgroundColor
void setFillBackgroundColor(short bg)
set the background fill color.- Parameters:
bg- color
-
getFillBackgroundColor
short getFillBackgroundColor()
get the background fill color, if the fill is defined with an indexed color.- Returns:
- fill color index, or 0 if not indexed (XSSF only)
-
getFillBackgroundColorColor
Color getFillBackgroundColorColor()
Gets the color object representing the current background fill, resolving indexes using the supplied workbook. This will work for both indexed and rgb defined colors.
-
setFillForegroundColor
void setFillForegroundColor(short bg)
set the foreground fill color Note: Ensure Foreground color is set prior to background color.- Parameters:
bg- color
-
getFillForegroundColor
short getFillForegroundColor()
get the foreground fill color, if the fill is defined with an indexed color.- Returns:
- fill color, or 0 if not indexed (XSSF only)
-
getFillForegroundColorColor
Color getFillForegroundColorColor()
Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook. This will work for both indexed and rgb defined colors.
-
cloneStyleFrom
void cloneStyleFrom(CellStyle source)
Clones all the style information from another CellStyle, onto this one. This CellStyle will then have all the same properties as the source, but the two may be edited independently. Any stylings on this CellStyle will be lost! The source CellStyle could be from another Workbook if you like. This allows you to copy styles from one Workbook to another. However, both of the CellStyles will need to be of the same type (HSSFCellStyle or XSSFCellStyle)
-
setShrinkToFit
void setShrinkToFit(boolean shrinkToFit)
Controls if the Cell should be auto-sized to shrink to fit if the text is too long
-
getShrinkToFit
boolean getShrinkToFit()
Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long?
-
-
DataMelt 3.0 © DataMelt by jWork.ORG