public class HSSFCellStyle extends Object
HSSFWorkbook.createCellStyle(), 
HSSFWorkbook.getCellStyleAt(short), 
HSSFCell.setCellStyle(HSSFCellStyle)| Modifier and Type | Field and Description | 
|---|---|
| static short | ALIGN_CENTERcenter horizontal alignment | 
| static short | ALIGN_CENTER_SELECTIONcenter-selection? horizontal alignment | 
| static short | ALIGN_FILLfill? horizontal alignment | 
| static short | ALIGN_GENERALgeneral (normal) horizontal alignment | 
| static short | ALIGN_JUSTIFYjustified horizontal alignment | 
| static short | ALIGN_LEFTleft-justified horizontal alignment | 
| static short | ALIGN_RIGHTright-justified horizontal alignment | 
| static short | ALT_BARSWide dots | 
| static short | BIG_SPOTSLarge spots | 
| static short | BORDER_DASH_DOTdash-dot border | 
| static short | BORDER_DASH_DOT_DOTdash-dot-dot border | 
| static short | BORDER_DASHEDdash border | 
| static short | BORDER_DOTTEDhair-line border | 
| static short | BORDER_DOUBLEdouble-line border | 
| static short | BORDER_HAIRdot border | 
| static short | BORDER_MEDIUMMedium border | 
| static short | BORDER_MEDIUM_DASH_DOTmedium dash-dot border | 
| static short | BORDER_MEDIUM_DASH_DOT_DOTmedium dash-dot-dot border | 
| static short | BORDER_MEDIUM_DASHEDMedium dashed border | 
| static short | BORDER_NONENo border | 
| static short | BORDER_SLANTED_DASH_DOTslanted dash-dot border | 
| static short | BORDER_THICKThick border | 
| static short | BORDER_THINThin border | 
| static short | BRICKSBrick-like layout | 
| static short | DIAMONDSDiamonds | 
| static short | FINE_DOTSSmall fine dots | 
| static short | LEAST_DOTSLeast Dots | 
| static short | LESS_DOTSLess Dots | 
| static short | NO_FILLNo background | 
| static short | SOLID_FOREGROUNDSolidly filled | 
| static short | SPARSE_DOTSSparse dots | 
| static short | SQUARESSquares | 
| static short | THICK_BACKWARD_DIAGThick backward facing diagonals | 
| static short | THICK_FORWARD_DIAGThick forward facing diagonals | 
| static short | THICK_HORZ_BANDSThick horizontal bands | 
| static short | THICK_VERT_BANDSThick vertical bands | 
| static short | THIN_BACKWARD_DIAGThin backward diagonal | 
| static short | THIN_FORWARD_DIAGThin forward diagonal | 
| static short | THIN_HORZ_BANDSThin horizontal bands | 
| static short | THIN_VERT_BANDSThin vertical bands | 
| static short | VERTICAL_BOTTOMbottom-aligned vertical alignment | 
| static short | VERTICAL_CENTERcenter-aligned vertical alignment | 
| static short | VERTICAL_JUSTIFYvertically justified vertical alignment | 
| static short | VERTICAL_TOPtop-aligned vertical alignment | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | HSSFCellStyle(short index,
             ExtendedFormatRecord rec)Creates new HSSFCellStyle why would you want to do this?? | 
| Modifier and Type | Method and Description | 
|---|---|
| short | getAlignment()get the type of horizontal alignment for the cell | 
| short | getBorderBottom()get the type of border to use for the bottom border of the cell | 
| short | getBorderLeft()get the type of border to use for the left border of the cell | 
| short | getBorderRight()get the type of border to use for the right border of the cell | 
| short | getBorderTop()get the type of border to use for the top border of the cell | 
| short | getBottomBorderColor()get the color to use for the left border | 
| short | getDataFormat()get the index of the format | 
| String | getDataFormatString(Workbook workbook)Get the contents of the format string, by looking up
  the DataFormat against the supplied workbook | 
| short | getFillBackgroundColor()get the background fill color | 
| short | getFillForegroundColor()get the foreground fill color | 
| short | getFillPattern()get the fill pattern (??) - set to 1 to fill with foreground color | 
| short | getFontIndex() | 
| 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 HSSFWorkbook (sequence within the collection of ExtnededFormat objects) | 
| short | getLeftBorderColor()get the color to use for the left border | 
| boolean | getLocked()get whether the cell's using this style are to be locked | 
| short | getRightBorderColor()get the color to use for the left border | 
| short | getRotation()get the degree of rotation for the text in the cell | 
| short | getTopBorderColor()get the color to use for the top border | 
| short | getVerticalAlignment()get the type of vertical alignment for the cell | 
| boolean | getWrapText()get whether the text should be wrapped | 
| void | setAlignment(short align)set the type of horizontal alignment for the cell | 
| void | setBorderBottom(short border)set the type of border to use for the bottom border of the cell | 
| void | setBorderLeft(short border)set the type of border to use for the left border of the cell | 
| void | setBorderRight(short border)set the type of border to use for the right border of the cell | 
| void | setBorderTop(short 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 | setDataFormat(short fmt)set the data format (must be a valid format) | 
| void | setFillBackgroundColor(short bg)set the background fill color. | 
| void | setFillForegroundColor(short bg)set the foreground fill color
 Note: Ensure Foreground color is set prior to background color. | 
| void | setFillPattern(short fp)setting to one fills the cell with the foreground color... | 
| void | setFont(HSSFFont 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 | 
| void | setLocked(boolean locked)set the cell's using this style to be locked | 
| void | setRightBorderColor(short color)set the color to use for the right border | 
| void | setRotation(short rotation)set the degree of rotation for the text in the cell | 
| void | setTopBorderColor(short color)set the color to use for the top border | 
| void | setVerticalAlignment(short align)set the type of vertical alignment for the cell | 
| void | setWrapText(boolean wrapped)set whether the text should be wrapped | 
public static final short ALIGN_GENERAL
public static final short ALIGN_LEFT
public static final short ALIGN_CENTER
public static final short ALIGN_RIGHT
public static final short ALIGN_FILL
public static final short ALIGN_JUSTIFY
public static final short ALIGN_CENTER_SELECTION
public static final short VERTICAL_TOP
public static final short VERTICAL_CENTER
public static final short VERTICAL_BOTTOM
public static final short VERTICAL_JUSTIFY
public static final short BORDER_NONE
public static final short BORDER_THIN
public static final short BORDER_MEDIUM
public static final short BORDER_DASHED
public static final short BORDER_HAIR
public static final short BORDER_THICK
public static final short BORDER_DOUBLE
public static final short BORDER_DOTTED
public static final short BORDER_MEDIUM_DASHED
public static final short BORDER_DASH_DOT
public static final short BORDER_MEDIUM_DASH_DOT
public static final short BORDER_DASH_DOT_DOT
public static final short BORDER_MEDIUM_DASH_DOT_DOT
public static final short BORDER_SLANTED_DASH_DOT
public static final short NO_FILL
public static final short SOLID_FOREGROUND
public static final short FINE_DOTS
public static final short ALT_BARS
public static final short SPARSE_DOTS
public static final short THICK_HORZ_BANDS
public static final short THICK_VERT_BANDS
public static final short THICK_BACKWARD_DIAG
public static final short THICK_FORWARD_DIAG
public static final short BIG_SPOTS
public static final short BRICKS
public static final short THIN_HORZ_BANDS
public static final short THIN_VERT_BANDS
public static final short THIN_BACKWARD_DIAG
public static final short THIN_FORWARD_DIAG
public static final short SQUARES
public static final short DIAMONDS
public static final short LESS_DOTS
public static final short LEAST_DOTS
protected HSSFCellStyle(short index,
             ExtendedFormatRecord rec)
public short getIndex()
public void setDataFormat(short fmt)
HSSFDataFormatpublic short getDataFormat()
HSSFDataFormatpublic String getDataFormatString(Workbook workbook)
HSSFDataFormatpublic void setFont(HSSFFont font)
font - a font object created or retreived from the HSSFWorkbook objectHSSFWorkbook.createFont(), 
HSSFWorkbook.getFontAt(short)public short getFontIndex()
public void setHidden(boolean hidden)
hidden - - whether the cell using this style should be hiddenpublic boolean getHidden()
public void setLocked(boolean locked)
locked - - whether the cell using this style should be lockedpublic boolean getLocked()
public void setAlignment(short align)
align - - the type of alignmentALIGN_GENERAL, 
ALIGN_LEFT, 
ALIGN_CENTER, 
ALIGN_RIGHT, 
ALIGN_FILL, 
ALIGN_JUSTIFY, 
ALIGN_CENTER_SELECTIONpublic short getAlignment()
ALIGN_GENERAL, 
ALIGN_LEFT, 
ALIGN_CENTER, 
ALIGN_RIGHT, 
ALIGN_FILL, 
ALIGN_JUSTIFY, 
ALIGN_CENTER_SELECTIONpublic void setWrapText(boolean wrapped)
wrapped - wrap text or notpublic boolean getWrapText()
public void setVerticalAlignment(short align)
align - the type of alignmentVERTICAL_TOP, 
VERTICAL_CENTER, 
VERTICAL_BOTTOM, 
VERTICAL_JUSTIFYpublic short getVerticalAlignment()
VERTICAL_TOP, 
VERTICAL_CENTER, 
VERTICAL_BOTTOM, 
VERTICAL_JUSTIFYpublic void setRotation(short rotation)
rotation - degrees (between -90 and 90 degrees)public short getRotation()
public void setIndention(short indent)
indent - - number of spacespublic short getIndention()
public void setBorderLeft(short border)
border - typeBORDER_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_DOTpublic short getBorderLeft()
public void setBorderRight(short border)
border - typeBORDER_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_DOTpublic short getBorderRight()
public void setBorderTop(short border)
border - typeBORDER_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_DOTpublic short getBorderTop()
public void setBorderBottom(short border)
border - typeBORDER_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_DOTpublic short getBorderBottom()
public void setLeftBorderColor(short color)
color - public short getLeftBorderColor()
public void setRightBorderColor(short color)
color - public short getRightBorderColor()
public void setTopBorderColor(short color)
color - public short getTopBorderColor()
public void setBottomBorderColor(short color)
color - public short getBottomBorderColor()
public void setFillPattern(short fp)
fp - fill pattern (set to 1 to fill w/foreground color)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, 
DIAMONDSpublic short getFillPattern()
public void setFillBackgroundColor(short bg)
For example:
cs.setFillPattern(HSSFCellStyle.FINE_DOTS ); cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());optionally a Foreground and background fill can be applied: Note: Ensure Foreground color is set prior to background
cs.setFillPattern(HSSFCellStyle.FINE_DOTS ); cs.setFillForegroundColor(new HSSFColor.BLUE().getIndex()); cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());or, for the special case of SOLID_FILL:
cs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND ); cs.setFillForegroundColor(new HSSFColor.RED().getIndex());It is necessary to set the fill style in order for the color to be shown in the cell.
bg - colorpublic short getFillBackgroundColor()
public void setFillForegroundColor(short bg)
bg - colorpublic short getFillForegroundColor()
Copyright © 2014 Open Microscopy Environment