## org.apache.poi.hssf.usermodel
Class HSSFCellStyle

    java.lang.Object
      org.apache.poi.hssf.usermodel.HSSFCellStyle

All Implemented Interfaces:
  CellStyle

    public final class HSSFCellStyle

extends java.lang.Object
implements CellStyle

High level representation of the style of a cell in a sheet of a workbook.

Author:
  Andrew C. Oliver (acoliver at apache dot org), Jason Height (jheight at chariot dot net dot au)
See Also:
  `HSSFWorkbook.createCellStyle()`, `HSSFWorkbook.getCellStyleAt(short)`, `HSSFCell.setCellStyle(HSSFCellStyle)`

Field Summary

Fields inherited from interface org.apache.poi.ss.usermodel.CellStyle

`ALIGN_CENTER, ALIGN_CENTER_SELECTION, ALIGN_FILL, ALIGN_GENERAL, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_RIGHT, ALT_BARS, BIG_SPOTS, BORDER_DASH_DOT, BORDER_DASH_DOT_DOT, BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_HAIR, BORDER_MEDIUM, BORDER_MEDIUM_DASH_DOT, BORDER_MEDIUM_DASH_DOT_DOT, BORDER_MEDIUM_DASHED, BORDER_NONE, BORDER_SLANTED_DASH_DOT, BORDER_THICK, BORDER_THIN, BRICKS, DIAMONDS, FINE_DOTS, LEAST_DOTS, LESS_DOTS, NO_FILL, SOLID_FOREGROUND, SPARSE_DOTS, SQUARES, THICK_BACKWARD_DIAG, THICK_FORWARD_DIAG, THICK_HORZ_BANDS, THICK_VERT_BANDS, THIN_BACKWARD_DIAG, THIN_FORWARD_DIAG, THIN_HORZ_BANDS, THIN_VERT_BANDS, VERTICAL_BOTTOM, VERTICAL_CENTER, VERTICAL_JUSTIFY, VERTICAL_TOP`

Constructor Summary
`protected` `HSSFCellStyle(short index, ExtendedFormatRecord rec, HSSFWorkbook workbook)` Creates new HSSFCellStyle why would you want to do this??
`protected` `HSSFCellStyle(short index, ExtendedFormatRecord rec, InternalWorkbook workbook)`

Method Summary
`void` `cloneStyleFrom(CellStyle source)` Clones all the style information from another HSSFCellStyle, onto this one.
`void` `cloneStyleFrom(HSSFCellStyle source)`
`boolean` `equals(java.lang.Object obj)`
`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
`java.lang.String` `getDataFormatString()` Get the contents of the format string, by looking up the DataFormat against the bound workbook
`java.lang.String` `getDataFormatString(InternalWorkbook workbook)` Get the contents of the format string, by looking up the DataFormat against the supplied low level workbook
`java.lang.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.
`HSSFColor` `getFillBackgroundColorColor()` Gets the color object representing the current background fill, resolving indexes using the supplied workbook.
`short` `getFillForegroundColor()` Get the foreground fill color.
`HSSFColor` `getFillForegroundColorColor()` Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook.
`short` `getFillPattern()` get the fill pattern (??) - set to 1 to fill with foreground color
`HSSFFont` `getFont(Workbook parentWorkbook)` 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 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
`HSSFCellStyle` `getParentStyle()` Return the parent style for this cell style.
`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
`java.lang.String` `getUserStyleName()` Gets the name of the user defined style.
`short` `getVerticalAlignment()` get the type of vertical alignment for the cell
`boolean` `getWrapText()` get whether the text should be wrapped
`int` `hashCode()`
`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(Font font)` set the font for this style
`void` `setFont(HSSFFont font)`
`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` `setUserStyleName(java.lang.String styleName)` Sets the name of the user defined style.
`void` `setVerticalAlignment(short align)` set the type of vertical alignment for the cell
`void` `setWrapText(boolean wrapped)` set whether the text should be wrapped
`void` `verifyBelongsToWorkbook(HSSFWorkbook wb)` Verifies that this style belongs to the supplied Workbook.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HSSFCellStyle

    protected HSSFCellStyle(short index,
                            ExtendedFormatRecord rec,
                            HSSFWorkbook workbook)

  Creates new HSSFCellStyle why would you want to do this??

### HSSFCellStyle

    protected HSSFCellStyle(short index,
                            ExtendedFormatRecord rec,
                            InternalWorkbook workbook)

Method Detail

### getIndex

    public short getIndex()

  get the index within the HSSFWorkbook (sequence within the collection of ExtnededFormat objects)

  Specified by:
    `getIndex` in interface `CellStyle`
  Returns:
    unique index number of the underlying record this style represents (probably you don't care unless you're comparing which one is which)

### getParentStyle

    public HSSFCellStyle getParentStyle()

  Return the parent style for this cell style. In most cases this will be null, but in a few cases there'll be a fully defined parent.

### setDataFormat

    public void setDataFormat(short fmt)

  set the data format (must be a valid format)

  Specified by:
    `setDataFormat` in interface `CellStyle`
  See Also:
    `HSSFDataFormat`

### getDataFormat

    public short getDataFormat()

  get the index of the format

  Specified by:
    `getDataFormat` in interface `CellStyle`
  See Also:
    `HSSFDataFormat`

### getDataFormatString

    public java.lang.String getDataFormatString()

  Get the contents of the format string, by looking up the DataFormat against the bound workbook

  Specified by:
    `getDataFormatString` in interface `CellStyle`
  Returns:
    the format string or "General" if not found
  See Also:
    `HSSFDataFormat`

### getDataFormatString

    public java.lang.String getDataFormatString(Workbook workbook)

  Get the contents of the format string, by looking up the DataFormat against the supplied workbook

  Returns:
    the format string or "General" if not found
  See Also:
    `HSSFDataFormat`

### getDataFormatString

    public java.lang.String getDataFormatString(InternalWorkbook workbook)

  Get the contents of the format string, by looking up the DataFormat against the supplied low level workbook

  See Also:
    `HSSFDataFormat`

### setFont

    public void setFont(Font font)

  set the font for this style

  Specified by:
    `setFont` in interface `CellStyle`
  Parameters:
    `font` - a font object created or retreived from the HSSFWorkbook object
  See Also:
    `HSSFWorkbook.createFont()`, `HSSFWorkbook.getFontAt(short)`

### setFont

    public void setFont(HSSFFont font)

### getFontIndex

    public short getFontIndex()

  gets the index of the font for this style

  Specified by:
    `getFontIndex` in interface `CellStyle`
  See Also:
    `HSSFWorkbook.getFontAt(short)`

### getFont

    public HSSFFont getFont(Workbook parentWorkbook)

  gets the font for this style

  Parameters:
    `parentWorkbook` - The HSSFWorkbook that this style belongs to
  See Also:
    `getFontIndex()`, `HSSFWorkbook.getFontAt(short)`

### setHidden

    public void setHidden(boolean hidden)

  set the cell's using this style to be hidden

  Specified by:
    `setHidden` in interface `CellStyle`
  Parameters:
    `hidden` - - whether the cell using this style should be hidden

### getHidden

    public boolean getHidden()

  get whether the cell's using this style are to be hidden

  Specified by:
    `getHidden` in interface `CellStyle`
  Returns:
    hidden - whether the cell using this style should be hidden

### setLocked

    public void setLocked(boolean locked)

  set the cell's using this style to be locked

  Specified by:
    `setLocked` in interface `CellStyle`
  Parameters:
    `locked` - - whether the cell using this style should be locked

### getLocked

    public boolean getLocked()

  get whether the cell's using this style are to be locked

  Specified by:
    `getLocked` in interface `CellStyle`
  Returns:
    hidden - whether the cell using this style should be locked

### setAlignment

    public void setAlignment(short align)

  set the type of horizontal alignment for the cell

  Specified by:
    `setAlignment` in interface `CellStyle`
  Parameters:
    `align` - - the type of alignment
  See Also:
    `CellStyle.ALIGN_GENERAL`, `CellStyle.ALIGN_LEFT`, `CellStyle.ALIGN_CENTER`, `CellStyle.ALIGN_RIGHT`, `CellStyle.ALIGN_FILL`, `CellStyle.ALIGN_JUSTIFY`, `CellStyle.ALIGN_CENTER_SELECTION`

### getAlignment

    public short getAlignment()

  get the type of horizontal alignment for the cell

  Specified by:
    `getAlignment` in interface `CellStyle`
  Returns:
    align - the type of alignment
  See Also:
    `CellStyle.ALIGN_GENERAL`, `CellStyle.ALIGN_LEFT`, `CellStyle.ALIGN_CENTER`, `CellStyle.ALIGN_RIGHT`, `CellStyle.ALIGN_FILL`, `CellStyle.ALIGN_JUSTIFY`, `CellStyle.ALIGN_CENTER_SELECTION`

### setWrapText

    public void setWrapText(boolean wrapped)

  set whether the text should be wrapped

  Specified by:
    `setWrapText` in interface `CellStyle`
  Parameters:
    `wrapped` - wrap text or not

### getWrapText

    public boolean getWrapText()

  get whether the text should be wrapped

  Specified by:
    `getWrapText` in interface `CellStyle`
  Returns:
    wrap text or not

### setVerticalAlignment

    public void setVerticalAlignment(short align)

  set the type of vertical alignment for the cell

  Specified by:
    `setVerticalAlignment` in interface `CellStyle`
  Parameters:
    `align` - the type of alignment
  See Also:
    `CellStyle.VERTICAL_TOP`, `CellStyle.VERTICAL_CENTER`, `CellStyle.VERTICAL_BOTTOM`, `CellStyle.VERTICAL_JUSTIFY`

### getVerticalAlignment

    public short getVerticalAlignment()

  get the type of vertical alignment for the cell

  Specified by:
    `getVerticalAlignment` in interface `CellStyle`
  Returns:
    align the type of alignment
  See Also:
    `CellStyle.VERTICAL_TOP`, `CellStyle.VERTICAL_CENTER`, `CellStyle.VERTICAL_BOTTOM`, `CellStyle.VERTICAL_JUSTIFY`

### setRotation

    public void setRotation(short rotation)

  set the degree of rotation for the text in the cell

  Specified by:
    `setRotation` in interface `CellStyle`
  Parameters:
    `rotation` - degrees (between -90 and 90 degrees, of 0xff for vertical)

### getRotation

    public short getRotation()

  get the degree of rotation for the text in the cell

  Specified by:
    `getRotation` in interface `CellStyle`
  Returns:
    rotation degrees (between -90 and 90 degrees, or 0xff for vertical)

### setIndention

    public void setIndention(short indent)

  set the number of spaces to indent the text in the cell

  Specified by:
    `setIndention` in interface `CellStyle`
  Parameters:
    `indent` - - number of spaces

### getIndention

    public short getIndention()

  get the number of spaces to indent the text in the cell

  Specified by:
    `getIndention` in interface `CellStyle`
  Returns:
    indent - number of spaces

### setBorderLeft

    public void setBorderLeft(short border)

  set the type of border to use for the left border of the cell

  Specified by:
    `setBorderLeft` in interface `CellStyle`
  Parameters:
    `border` - type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### getBorderLeft

    public short getBorderLeft()

  get the type of border to use for the left border of the cell

  Specified by:
    `getBorderLeft` in interface `CellStyle`
  Returns:
    border type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### setBorderRight

    public void setBorderRight(short border)

  set the type of border to use for the right border of the cell

  Specified by:
    `setBorderRight` in interface `CellStyle`
  Parameters:
    `border` - type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### getBorderRight

    public short getBorderRight()

  get the type of border to use for the right border of the cell

  Specified by:
    `getBorderRight` in interface `CellStyle`
  Returns:
    border type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### setBorderTop

    public void setBorderTop(short border)

  set the type of border to use for the top border of the cell

  Specified by:
    `setBorderTop` in interface `CellStyle`
  Parameters:
    `border` - type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### getBorderTop

    public short getBorderTop()

  get the type of border to use for the top border of the cell

  Specified by:
    `getBorderTop` in interface `CellStyle`
  Returns:
    border type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### setBorderBottom

    public void setBorderBottom(short border)

  set the type of border to use for the bottom border of the cell

  Specified by:
    `setBorderBottom` in interface `CellStyle`
  Parameters:
    `border` - type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### getBorderBottom

    public short getBorderBottom()

  get the type of border to use for the bottom border of the cell

  Specified by:
    `getBorderBottom` in interface `CellStyle`
  Returns:
    border type
  See Also:
    `CellStyle.BORDER_NONE`, `CellStyle.BORDER_THIN`, `CellStyle.BORDER_MEDIUM`, `CellStyle.BORDER_DASHED`, `CellStyle.BORDER_DOTTED`, `CellStyle.BORDER_THICK`, `CellStyle.BORDER_DOUBLE`, `CellStyle.BORDER_HAIR`, `CellStyle.BORDER_MEDIUM_DASHED`, `CellStyle.BORDER_DASH_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT`, `CellStyle.BORDER_DASH_DOT_DOT`, `CellStyle.BORDER_MEDIUM_DASH_DOT_DOT`, `CellStyle.BORDER_SLANTED_DASH_DOT`

### setLeftBorderColor

    public void setLeftBorderColor(short color)

  set the color to use for the left border

  Specified by:
    `setLeftBorderColor` in interface `CellStyle`
  Parameters:
    `color` - The index of the color definition

### getLeftBorderColor

    public short getLeftBorderColor()

  get the color to use for the left border

  Specified by:
    `getLeftBorderColor` in interface `CellStyle`
  Returns:
    The index of the color definition
  See Also:
    `HSSFPalette.getColor(short)`

### setRightBorderColor

    public void setRightBorderColor(short color)

  set the color to use for the right border

  Specified by:
    `setRightBorderColor` in interface `CellStyle`
  Parameters:
    `color` - The index of the color definition

### getRightBorderColor

    public short getRightBorderColor()

  get the color to use for the left border

  Specified by:
    `getRightBorderColor` in interface `CellStyle`
  Returns:
    The index of the color definition
  See Also:
    `HSSFPalette.getColor(short)`

### setTopBorderColor

    public void setTopBorderColor(short color)

  set the color to use for the top border

  Specified by:
    `setTopBorderColor` in interface `CellStyle`
  Parameters:
    `color` - The index of the color definition

### getTopBorderColor

    public short getTopBorderColor()

  get the color to use for the top border

  Specified by:
    `getTopBorderColor` in interface `CellStyle`
  Returns:
    The index of the color definition
  See Also:
    `HSSFPalette.getColor(short)`

### setBottomBorderColor

    public void setBottomBorderColor(short color)

  set the color to use for the bottom border

  Specified by:
    `setBottomBorderColor` in interface `CellStyle`
  Parameters:
    `color` - The index of the color definition

### getBottomBorderColor

    public short getBottomBorderColor()

  get the color to use for the left border

  Specified by:
    `getBottomBorderColor` in interface `CellStyle`
  Returns:
    The index of the color definition
  See Also:
    `HSSFPalette.getColor(short)`

### setFillPattern

    public void setFillPattern(short fp)

  setting to one fills the cell with the foreground color... No idea about other values

  Specified by:
    `setFillPattern` in interface `CellStyle`
  Parameters:
    `fp` - fill pattern (set to 1 to fill w/foreground color)
  See Also:
    `CellStyle.NO_FILL`, `CellStyle.SOLID_FOREGROUND`, `CellStyle.FINE_DOTS`, `CellStyle.ALT_BARS`, `CellStyle.SPARSE_DOTS`, `CellStyle.THICK_HORZ_BANDS`, `CellStyle.THICK_VERT_BANDS`, `CellStyle.THICK_BACKWARD_DIAG`, `CellStyle.THICK_FORWARD_DIAG`, `CellStyle.BIG_SPOTS`, `CellStyle.BRICKS`, `CellStyle.THIN_HORZ_BANDS`, `CellStyle.THIN_VERT_BANDS`, `CellStyle.THIN_BACKWARD_DIAG`, `CellStyle.THIN_FORWARD_DIAG`, `CellStyle.SQUARES`, `CellStyle.DIAMONDS`

### getFillPattern

    public short getFillPattern()

  get the fill pattern (??) - set to 1 to fill with foreground color

  Specified by:
    `getFillPattern` in interface `CellStyle`
  Returns:
    fill pattern

### setFillBackgroundColor

    public void setFillBackgroundColor(short bg)

  set the background fill color.

  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.

  Specified by:
    `setFillBackgroundColor` in interface `CellStyle`
  Parameters:
    `bg` - color

### getFillBackgroundColor

    public short getFillBackgroundColor()

  Get the background fill color. Note - many cells are actually filled with a foreground fill, not a background fill - see `getFillForegroundColor()`

  Specified by:
    `getFillBackgroundColor` in interface `CellStyle`
  Returns:
    fill color
  See Also:
    `HSSFPalette.getColor(short)`

### getFillBackgroundColorColor

    public HSSFColor getFillBackgroundColorColor()

  Description copied from interface: `CellStyle`
  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.

  Specified by:
    `getFillBackgroundColorColor` in interface `CellStyle`

### setFillForegroundColor

    public void setFillForegroundColor(short bg)

  set the foreground fill color Note: Ensure Foreground color is set prior to background color.

  Specified by:
    `setFillForegroundColor` in interface `CellStyle`
  Parameters:
    `bg` - color

### getFillForegroundColor

    public short getFillForegroundColor()

  Get the foreground fill color. Many cells are filled with this, instead of a background color (`getFillBackgroundColor()`)

  Specified by:
    `getFillForegroundColor` in interface `CellStyle`
  Returns:
    fill color
  See Also:
    `HSSFPalette.getColor(short)`

### getFillForegroundColorColor

    public HSSFColor getFillForegroundColorColor()

  Description copied from interface: `CellStyle`
  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.

  Specified by:
    `getFillForegroundColorColor` in interface `CellStyle`

### getUserStyleName

    public java.lang.String getUserStyleName()

  Gets the name of the user defined style. Returns null for built in styles, and styles where no name has been defined

### setUserStyleName

    public void setUserStyleName(java.lang.String styleName)

  Sets the name of the user defined style. Will complain if you try this on a built in style.

### verifyBelongsToWorkbook

    public void verifyBelongsToWorkbook(HSSFWorkbook wb)

  Verifies that this style belongs to the supplied Workbook. Will throw an exception if it belongs to a different one. This is normally called when trying to assign a style to a cell, to ensure the cell and the style are from the same workbook (if they're not, it won't work)

  Throws:
    `java.lang.IllegalArgumentException` - if there's a workbook mis-match

### cloneStyleFrom

    public void cloneStyleFrom(CellStyle source)

  Clones all the style information from another HSSFCellStyle, onto this one. This HSSFCellStyle will then have all the same properties as the source, but the two may be edited independently. Any stylings on this HSSFCellStyle will be lost! The source HSSFCellStyle could be from another HSSFWorkbook if you like. This allows you to copy styles from one HSSFWorkbook to another.

  Specified by:
    `cloneStyleFrom` in interface `CellStyle`

### cloneStyleFrom

    public void cloneStyleFrom(HSSFCellStyle source)

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

Copyright 2012 The Apache Software Foundation or its licensors, as applicable.