org.apache.poi.ss.usermodel

## Interface CellStyle

- All Known Implementing Classes:
    HSSFCellStyle, XSSFCellStyle

      public interface CellStyle

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cloneStyleFrom(CellStyle source)` Clones all the style information from another CellStyle, onto this one.
    `HorizontalAlignment` | `getAlignment()` get the type of horizontal alignment for the cell
    `HorizontalAlignment` | `getAlignmentEnum()` Deprecated. use `getAlignment()` instead
    `BorderStyle` | `getBorderBottom()` get the type of border to use for the bottom border of the cell
    `BorderStyle` | `getBorderBottomEnum()` Deprecated. use `getBorderBottom()` instead
    `BorderStyle` | `getBorderLeft()` get the type of border to use for the left border of the cell
    `BorderStyle` | `getBorderLeftEnum()` Deprecated. use `getBorderLeft()` instead
    `BorderStyle` | `getBorderRight()` get the type of border to use for the right border of the cell
    `BorderStyle` | `getBorderRightEnum()` Deprecated. use `getBorderRight()` instead
    `BorderStyle` | `getBorderTop()` get the type of border to use for the top border of the cell
    `BorderStyle` | `getBorderTopEnum()` Deprecated. use `getBorderTop()` instead
    `short` | `getBottomBorderColor()` get the color to use for the left border
    `short` | `getDataFormat()` get the index of the data format.
    `java.lang.String` | `getDataFormatString()` Get the format string
    `short` | `getFillBackgroundColor()` get the background fill color, if the fill is defined with an indexed color.
    `Color` | `getFillBackgroundColorColor()` Gets the color object representing the current background fill, resolving indexes using the supplied workbook.
    `short` | `getFillForegroundColor()` get the foreground fill color, if the fill is defined with an indexed color.
    `Color` | `getFillForegroundColorColor()` Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook.
    `FillPatternType` | `getFillPattern()` Get the fill pattern
    `FillPatternType` | `getFillPatternEnum()` Deprecated. use `getFillPattern()` instead
    `short` | `getFontIndex()` Deprecated. use `getFontIndexAsInt()` instead
    `int` | `getFontIndexAsInt()` 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 Workbook (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
    `boolean` | `getQuotePrefixed()` Is "Quote Prefix" or "123 Prefix" enabled for the cell? Having this on is somewhat (but not completely, see `IgnoredErrorType`) like prefixing the cell value with a ' in Excel
    `short` | `getRightBorderColor()` get the color to use for the left 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?
    `short` | `getTopBorderColor()` get the color to use for the top border
    `VerticalAlignment` | `getVerticalAlignment()` get the type of vertical alignment for the cell
    `VerticalAlignment` | `getVerticalAlignmentEnum()` Deprecated. use `getVerticalAlignment()` instead
    `boolean` | `getWrapText()` get whether the text should be wrapped
    `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` | `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` | `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(FillPatternType fp)` setting to one fills the cell with the foreground color...
    `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
    `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` | `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` | `setVerticalAlignment(VerticalAlignment align)` set the type of vertical alignment for the cell
    `void` | `setWrapText(boolean wrapped)` Set whether the text should be wrapped.

- - ### 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). Built in formats are defined at `BuiltinFormats`.
      See Also:
        `DataFormat`

    - #### getDataFormat

          short getDataFormat()

      get the index of the data format. Built in formats are defined at `BuiltinFormats`.
      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 retrieved from the Workbook object
      See Also:
        `Workbook.createFont()`, `Workbook.getFontAt(int)`

    - #### getFontIndex

          @Removal(version="4.2")
          short getFontIndex()

      Deprecated. use `getFontIndexAsInt()` instead
      gets the index of the font for this style
      See Also:
        `Workbook.getFontAt(short)`

    - #### getFontIndexAsInt

          int getFontIndexAsInt()

      gets the index of the font for this style
      Since:
        4.0.0
      See Also:
        `Workbook.getFontAt(int)`

    - #### 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

    - #### setQuotePrefixed

          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. Turning this on is somewhat (but not completely, see `IgnoredErrorType`) like prefixing the cell value with a ' in Excel

    - #### getQuotePrefixed

          boolean getQuotePrefixed()

      Is "Quote Prefix" or "123 Prefix" enabled for the cell? Having this on is somewhat (but not completely, see `IgnoredErrorType`) like prefixing the cell value with a ' in Excel

    - #### setAlignment

          void setAlignment(HorizontalAlignment align)

      set the type of horizontal alignment for the cell
      Parameters:
        `align` - - the type of alignment

    - #### getAlignment

          HorizontalAlignment getAlignment()

      get the type of horizontal alignment for the cell
      Returns:
        align - the type of alignment

    - #### getAlignmentEnum

          @Removal(version="4.2")
           @Deprecated
          HorizontalAlignment getAlignmentEnum()

      Deprecated. use `getAlignment()` instead
      get the type of horizontal alignment for the cell
      Returns:
        align - the type of alignment

    - #### setWrapText

          void setWrapText(boolean wrapped)

      Set whether the text should be wrapped. Setting this flag to `true` make all content visible within 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(VerticalAlignment align)

      set the type of vertical alignment for the cell
      Parameters:
        `align` - the type of alignment

    - #### getVerticalAlignment

          VerticalAlignment getVerticalAlignment()

      get the type of vertical alignment for the cell
      Returns:
        align the type of alignment

    - #### getVerticalAlignmentEnum

          @Removal(version="4.2")
           @Deprecated
          VerticalAlignment getVerticalAlignmentEnum()

      Deprecated. use `getVerticalAlignment()` instead
      get the type of vertical alignment for the cell
      Returns:
        align the type of alignment

    - #### setRotation

          void setRotation(short rotation)

      set the degree of rotation for the text in the cell. Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges accordingly, however the corresponding getter is returning values in the range mandated by the current type of Excel file-format that this CellStyle is applied to.
      Parameters:
        `rotation` - degrees (see note above)

    - #### getRotation

          short getRotation()

      get the degree of rotation for the text in the cell. Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges value-range as used by the type of Excel file-format that this CellStyle is applied to.
      Returns:
        rotation degrees (see note above)

    - #### 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(BorderStyle border)

      set the type of border to use for the left border of the cell
      Parameters:
        `border` - type
      Since:
        POI 3.15

    - #### getBorderLeft

          BorderStyle getBorderLeft()

      get the type of border to use for the left border of the cell
      Returns:
        border type
      Since:
        POI 4.0.0

    - #### getBorderLeftEnum

          @Removal(version="4.2")
           @Deprecated
          BorderStyle getBorderLeftEnum()

      Deprecated. use `getBorderLeft()` instead
      get the type of border to use for the left border of the cell
      Returns:
        border type
      Since:
        POI 3.15

    - #### setBorderRight

          void setBorderRight(BorderStyle border)

      set the type of border to use for the right border of the cell
      Parameters:
        `border` - type
      Since:
        POI 3.15

    - #### getBorderRight

          BorderStyle getBorderRight()

      get the type of border to use for the right border of the cell
      Returns:
        border type
      Since:
        POI 4.0.0

    - #### getBorderRightEnum

          @Removal(version="4.2")
           @Deprecated
          BorderStyle getBorderRightEnum()

      Deprecated. use `getBorderRight()` instead
      get the type of border to use for the right border of the cell
      Returns:
        border type
      Since:
        POI 3.15

    - #### setBorderTop

          void setBorderTop(BorderStyle border)

      set the type of border to use for the top border of the cell
      Parameters:
        `border` - type
      Since:
        POI 3.15

    - #### getBorderTop

          BorderStyle getBorderTop()

      get the type of border to use for the top border of the cell
      Returns:
        border type
      Since:
        POI 4.0.0

    - #### getBorderTopEnum

          @Removal(version="4.2")
           @Deprecated
          BorderStyle getBorderTopEnum()

      Deprecated. use `getBorderTop()` instead
      get the type of border to use for the top border of the cell
      Returns:
        border type
      Since:
        POI 3.15

    - #### setBorderBottom

          void setBorderBottom(BorderStyle border)

      set the type of border to use for the bottom border of the cell
      Parameters:
        `border` - type
      Since:
        POI 3.15

    - #### getBorderBottom

          BorderStyle getBorderBottom()

      get the type of border to use for the bottom border of the cell
      Returns:
        border type
      Since:
        POI 4.0.0

    - #### getBorderBottomEnum

          @Removal(version="4.2")
           @Deprecated
          BorderStyle getBorderBottomEnum()

      Deprecated. use `getBorderBottom()` instead
      get the type of border to use for the bottom border of the cell
      Returns:
        border type
      Since:
        POI 3.15

    - #### 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:
        the 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(FillPatternType fp)

      setting to one fills the cell with the foreground color... No idea about other values
      Parameters:
        `fp` - fill pattern (set to `FillPatternType.SOLID_FOREGROUND` to fill w/foreground color)
      Since:
        POI 3.15 beta 3

    - #### getFillPattern

          FillPatternType getFillPattern()

      Get the fill pattern
      Returns:
        the fill pattern, default value is `FillPatternType.NO_FILL`
      Since:
        POI 4.0.0

    - #### getFillPatternEnum

          @Removal(version="4.2")
           @Deprecated
          FillPatternType getFillPatternEnum()

      Deprecated. use `getFillPattern()` instead
      Get the fill pattern
      Returns:
        the fill pattern, default value is `FillPatternType.NO_FILL`
      Since:
        POI 3.15 beta 3

    - #### 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?

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