Class XSSFCellStyle
- java.lang.Object
-
- org.apache.poi.xssf.usermodel.XSSFCellStyle
-
-
Constructor Summary
Constructors Constructor Description XSSFCellStyle(int cellXfId, int cellStyleXfId, StylesTable stylesSource, ThemesTable theme)
Creates a Cell Style from the supplied partsXSSFCellStyle(StylesTable stylesSource)
Creates an empty Cell Style
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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 styleHorizontalAlignment
getAlignment()
get the type of horizontal alignment for the cellHorizontalAlignment
getAlignmentEnum()
get the type of horizontal alignment for the cellBorderStyle
getBorderBottom()
get the type of border to use for the bottom border of the cellBorderStyle
getBorderBottomEnum()
get the type of border to use for the bottom border of the cellXSSFColor
getBorderColor(XSSFCellBorder.BorderSide side)
Gets border colorBorderStyle
getBorderLeft()
get the type of border to use for the left border of the cellBorderStyle
getBorderLeftEnum()
get the type of border to use for the left border of the cellBorderStyle
getBorderRight()
get the type of border to use for the right border of the cellBorderStyle
getBorderRightEnum()
get the type of border to use for the right border of the cellBorderStyle
getBorderTop()
get the type of border to use for the top border of the cellBorderStyle
getBorderTopEnum()
get the type of border to use for the top border of the cellshort
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 aXSSFColor
CTXf
getCoreXf()
Used so that StylesSource can figure out our locationshort
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 StylesSourceshort
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.FillPatternType
getFillPattern()
Get the fill patternFillPatternType
getFillPatternEnum()
Get the fill patternXSSFFont
getFont()
Gets the font for this styleshort
getFontIndex()
Deprecated.int
getFontIndexAsInt()
Gets the index of the font for this styleboolean
getHidden()
Get whether the cell's using this style are to be hiddenshort
getIndention()
Get the number of spaces to indent the text in the cellshort
getIndex()
Get the index within the StylesTable (sequence within the collection of CTXf elements)short
getLeftBorderColor()
Get the color to use for the left borderXSSFColor
getLeftBorderXSSFColor()
Get the color to use for the left borderboolean
getLocked()
Get whether the cell's using this style are lockedboolean
getQuotePrefixed()
Is "Quote Prefix" or "123 Prefix" enabled for the cell?ReadingOrder
getReadingOrder()
Get reading order of the cellshort
getRightBorderColor()
Get the color to use for the right borderXSSFColor
getRightBorderXSSFColor()
Get the color to use for the right bordershort
getRotation()
Get the degree of rotation for the text in the cellboolean
getShrinkToFit()
Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long?CTXf
getStyleXf()
Used so that StylesSource can figure out our locationshort
getTopBorderColor()
Get the color to use for the top borderXSSFColor
getTopBorderXSSFColor()
Get the color to use for the top borderVerticalAlignment
getVerticalAlignment()
get the type of vertical alignment for the cellVerticalAlignment
getVerticalAlignmentEnum()
get the type of vertical alignment for the cellboolean
getWrapText()
Whether the text should be wrappedint
hashCode()
Returns a hash code value for the object.void
setAlignment(HorizontalAlignment align)
Set the type of horizontal alignment for the cellvoid
setBorderBottom(BorderStyle border)
Set the type of border to use for the bottom border of the cellvoid
setBorderColor(XSSFCellBorder.BorderSide side, XSSFColor color)
Set the color to use for the selected bordervoid
setBorderLeft(BorderStyle border)
Set the type of border to use for the left border of the cellvoid
setBorderRight(BorderStyle border)
Set the type of border to use for the right border of the cellvoid
setBorderTop(BorderStyle border)
Set the type of border to use for the top border of the cellvoid
setBottomBorderColor(short color)
Set the color to use for the bottom bordervoid
setBottomBorderColor(XSSFColor color)
Set the color to use for the bottom bordervoid
setDataFormat(int fmt)
Set the index of a data formatvoid
setDataFormat(short fmt)
Set the index of a data formatvoid
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 aXSSFColor
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 aXSSFColor
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 stylevoid
setHidden(boolean hidden)
Set the cell's using this style to be hiddenvoid
setIndention(short indent)
Set the number of spaces to indent the text in the cellvoid
setLeftBorderColor(short color)
Set the color to use for the left border as a indexed color valuevoid
setLeftBorderColor(XSSFColor color)
Set the color to use for the left border as aXSSFColor
valuevoid
setLocked(boolean locked)
Set the cell's using this style to be lockedvoid
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
setReadingOrder(ReadingOrder order)
Set reading order for the cellvoid
setRightBorderColor(short color)
Set the color to use for the right bordervoid
setRightBorderColor(XSSFColor color)
Set the color to use for the right border as aXSSFColor
valuevoid
setRotation(short rotation)
Set the degree of rotation for the text in the cellvoid
setShrinkToFit(boolean shrinkToFit)
Controls if the Cell should be auto-sized to shrink to fit if the text is too longvoid
setTopBorderColor(short color)
Set the color to use for the top bordervoid
setTopBorderColor(XSSFColor color)
Set the color to use for the top border as aXSSFColor
valuevoid
setVerticalAlignment(VerticalAlignment align)
Set the type of vertical alignment for the cellvoid
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.
-
-
-
Constructor Detail
-
XSSFCellStyle
public XSSFCellStyle(int cellXfId, int cellStyleXfId, StylesTable stylesSource, ThemesTable theme)
Creates a Cell Style from the supplied parts- Parameters:
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 off
-
XSSFCellStyle
public XSSFCellStyle(StylesTable stylesSource)
Creates an empty Cell Style
-
-
Method Detail
-
verifyBelongsToStylesSource
public void verifyBelongsToStylesSource(StylesTable src)
Verifies that this style belongs to the supplied Workbook Styles Source. 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 XSSFCellStyle, onto this one. This XSSFCellStyle will then have all the same properties as the source, but the two may be edited independently. Any stylings on this XSSFCellStyle will be lost! The source XSSFCellStyle could be from another XSSFWorkbook if you like. This allows you to copy styles from one XSSFWorkbook to another.- Specified by:
cloneStyleFrom
in interfaceCellStyle
-
getAlignment
public HorizontalAlignment getAlignment()
Description copied from interface:CellStyle
get the type of horizontal alignment for the cell- Specified by:
getAlignment
in interfaceCellStyle
- Returns:
- align - the type of alignment
-
getAlignmentEnum
public HorizontalAlignment getAlignmentEnum()
Description copied from interface:CellStyle
get the type of horizontal alignment for the cell- Specified by:
getAlignmentEnum
in interfaceCellStyle
- Returns:
- align - the type of alignment
-
getBorderBottom
public BorderStyle getBorderBottom()
Description copied from interface:CellStyle
get the type of border to use for the bottom border of the cell- Specified by:
getBorderBottom
in interfaceCellStyle
- Returns:
- border type
-
getBorderBottomEnum
public BorderStyle getBorderBottomEnum()
Description copied from interface:CellStyle
get the type of border to use for the bottom border of the cell- Specified by:
getBorderBottomEnum
in interfaceCellStyle
- Returns:
- border type
-
getBorderLeft
public BorderStyle getBorderLeft()
Description copied from interface:CellStyle
get the type of border to use for the left border of the cell- Specified by:
getBorderLeft
in interfaceCellStyle
- Returns:
- border type
-
getBorderLeftEnum
public BorderStyle getBorderLeftEnum()
Description copied from interface:CellStyle
get the type of border to use for the left border of the cell- Specified by:
getBorderLeftEnum
in interfaceCellStyle
- Returns:
- border type
-
getBorderRight
public BorderStyle getBorderRight()
Description copied from interface:CellStyle
get the type of border to use for the right border of the cell- Specified by:
getBorderRight
in interfaceCellStyle
- Returns:
- border type
-
getBorderRightEnum
public BorderStyle getBorderRightEnum()
Description copied from interface:CellStyle
get the type of border to use for the right border of the cell- Specified by:
getBorderRightEnum
in interfaceCellStyle
- Returns:
- border type
-
getBorderTop
public BorderStyle getBorderTop()
Description copied from interface:CellStyle
get the type of border to use for the top border of the cell- Specified by:
getBorderTop
in interfaceCellStyle
- Returns:
- border type
-
getBorderTopEnum
public BorderStyle getBorderTopEnum()
Description copied from interface:CellStyle
get the type of border to use for the top border of the cell- Specified by:
getBorderTopEnum
in interfaceCellStyle
- Returns:
- border type
-
getBottomBorderColor
public short getBottomBorderColor()
Get the color to use for the bottom border
Color is optional. When missing, IndexedColors.AUTOMATIC is implied.- Specified by:
getBottomBorderColor
in interfaceCellStyle
- Returns:
- the index of the color definition, default value is
IndexedColors.AUTOMATIC
- See Also:
IndexedColors
-
getBottomBorderXSSFColor
public XSSFColor getBottomBorderXSSFColor()
Get the color to use for the bottom border as aXSSFColor
- Returns:
- the used color or
null
if not set
-
getDataFormat
public short getDataFormat()
Get the index of the number format (numFmt) record used by this cell format.- Specified by:
getDataFormat
in interfaceCellStyle
- Returns:
- the index of the number format
- See Also:
DataFormat
-
getDataFormatString
public java.lang.String getDataFormatString()
Get the contents of the format string, by looking up the StylesSource- Specified by:
getDataFormatString
in interfaceCellStyle
- Returns:
- the number format string
-
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 interfaceCellStyle
- Returns:
- fill color, default value is
IndexedColors.AUTOMATIC
- See Also:
IndexedColors
-
getFillBackgroundColorColor
public XSSFColor 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 interfaceCellStyle
-
getFillBackgroundXSSFColor
public XSSFColor getFillBackgroundXSSFColor()
Get the background fill color.Note - many cells are actually filled with a foreground fill, not a background fill - see
getFillForegroundColor()
- Returns:
- XSSFColor - fill color or
null
if not set - See Also:
XSSFColor.getRGB()
-
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 interfaceCellStyle
- Returns:
- fill color, default value is
IndexedColors.AUTOMATIC
- See Also:
IndexedColors
-
getFillForegroundColorColor
public XSSFColor 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 interfaceCellStyle
-
getFillForegroundXSSFColor
public XSSFColor getFillForegroundXSSFColor()
Get the foreground fill color.- Returns:
- XSSFColor - fill color or
null
if not set
-
getFillPattern
public FillPatternType getFillPattern()
Description copied from interface:CellStyle
Get the fill pattern- Specified by:
getFillPattern
in interfaceCellStyle
- Returns:
- the fill pattern, default value is
FillPatternType.NO_FILL
-
getFillPatternEnum
public FillPatternType getFillPatternEnum()
Description copied from interface:CellStyle
Get the fill pattern- Specified by:
getFillPatternEnum
in interfaceCellStyle
- Returns:
- the fill pattern, default value is
FillPatternType.NO_FILL
-
getFont
public XSSFFont getFont()
Gets the font for this style- Returns:
- Font - font
-
getFontIndex
@Deprecated public short getFontIndex()
Deprecated.Gets the index of the font for this style- Specified by:
getFontIndex
in interfaceCellStyle
- Returns:
- short - font index
- See Also:
XSSFWorkbook.getFontAt(short)
-
getFontIndexAsInt
public int getFontIndexAsInt()
Gets the index of the font for this style- Specified by:
getFontIndexAsInt
in interfaceCellStyle
- Returns:
- short - font index
- Since:
- 4.0.0
- See Also:
XSSFWorkbook.getFontAt(int)
-
getHidden
public boolean getHidden()
Get whether the cell's using this style are to be hidden
-
getIndention
public short getIndention()
Get the number of spaces to indent the text in the cell- Specified by:
getIndention
in interfaceCellStyle
- Returns:
- indent - number of spaces
-
getIndex
public short getIndex()
Get the index within the StylesTable (sequence within the collection of CTXf elements)
-
getLeftBorderColor
public short getLeftBorderColor()
Get the color to use for the left border- Specified by:
getLeftBorderColor
in interfaceCellStyle
- Returns:
- the index of the color definition, default value is
IndexedColors.BLACK
- See Also:
IndexedColors
-
getLeftBorderXSSFColor
public XSSFColor getLeftBorderXSSFColor()
Get the color to use for the left border- Returns:
- the index of the color definition or
null
if not set - See Also:
IndexedColors
-
getLocked
public boolean getLocked()
Get whether the cell's using this style are locked
-
getQuotePrefixed
public boolean getQuotePrefixed()
Is "Quote Prefix" or "123 Prefix" enabled for the cell?- Specified by:
getQuotePrefixed
in interfaceCellStyle
-
getRightBorderColor
public short getRightBorderColor()
Get the color to use for the right border- Specified by:
getRightBorderColor
in interfaceCellStyle
- Returns:
- the index of the color definition, default value is
IndexedColors.BLACK
- See Also:
IndexedColors
-
getRightBorderXSSFColor
public XSSFColor getRightBorderXSSFColor()
Get the color to use for the right border- Returns:
- the used color or
null
if not set
-
getRotation
public short getRotation()
Get the degree of rotation for the text in the cellExpressed 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.
- Specified by:
getRotation
in interfaceCellStyle
- Returns:
- rotation degrees (between 0 and 180 degrees)
-
getShrinkToFit
public boolean getShrinkToFit()
Description copied from interface:CellStyle
Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long?- Specified by:
getShrinkToFit
in interfaceCellStyle
-
getTopBorderColor
public short getTopBorderColor()
Get the color to use for the top border- Specified by:
getTopBorderColor
in interfaceCellStyle
- Returns:
- the index of the color definition, default value is
IndexedColors.BLACK
- See Also:
IndexedColors
-
getTopBorderXSSFColor
public XSSFColor getTopBorderXSSFColor()
Get the color to use for the top border- Returns:
- the used color or
null
if not set
-
getVerticalAlignment
public VerticalAlignment getVerticalAlignment()
Description copied from interface:CellStyle
get the type of vertical alignment for the cell- Specified by:
getVerticalAlignment
in interfaceCellStyle
- Returns:
- align the type of alignment
-
getVerticalAlignmentEnum
public VerticalAlignment getVerticalAlignmentEnum()
Description copied from interface:CellStyle
get the type of vertical alignment for the cell- Specified by:
getVerticalAlignmentEnum
in interfaceCellStyle
- Returns:
- align the type of alignment
-
getWrapText
public boolean getWrapText()
Whether the text should be wrapped- Specified by:
getWrapText
in interfaceCellStyle
- Returns:
- a boolean value indicating if the text in a cell should be line-wrapped within the cell.
-
setAlignment
public void setAlignment(HorizontalAlignment align)
Set the type of horizontal alignment for the cell- Specified by:
setAlignment
in interfaceCellStyle
- Parameters:
align
- - the type of alignment
-
setBorderBottom
public void setBorderBottom(BorderStyle border)
Set the type of border to use for the bottom border of the cell- Specified by:
setBorderBottom
in interfaceCellStyle
- Parameters:
border
- - type of border to use- Since:
- POI 3.15
- See Also:
BorderStyle
-
setBorderLeft
public void setBorderLeft(BorderStyle border)
Set the type of border to use for the left border of the cell- Specified by:
setBorderLeft
in interfaceCellStyle
- Parameters:
border
- the type of border to use- Since:
- POI 3.15
-
setBorderRight
public void setBorderRight(BorderStyle border)
Set the type of border to use for the right border of the cell- Specified by:
setBorderRight
in interfaceCellStyle
- Parameters:
border
- the type of border to use- Since:
- POI 3.15
-
setBorderTop
public void setBorderTop(BorderStyle border)
Set the type of border to use for the top border of the cell- Specified by:
setBorderTop
in interfaceCellStyle
- Parameters:
border
- the type of border to use- Since:
- POI 3.15
-
setBottomBorderColor
public void setBottomBorderColor(short color)
Set the color to use for the bottom border- Specified by:
setBottomBorderColor
in interfaceCellStyle
- Parameters:
color
- the index of the color definition- See Also:
IndexedColors
-
setBottomBorderColor
public void setBottomBorderColor(XSSFColor color)
Set the color to use for the bottom border- Parameters:
color
- the color to use, null means no color
-
setDataFormat
public void setDataFormat(short fmt)
Set the index of a data format- Specified by:
setDataFormat
in interfaceCellStyle
- Parameters:
fmt
- the index of a data format- See Also:
DataFormat
-
setDataFormat
public void setDataFormat(int fmt)
Set the index of a data format- Parameters:
fmt
- the index of a data format
-
setFillBackgroundColor
public void setFillBackgroundColor(XSSFColor color)
Set the background fill color represented as aXSSFColor
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 backgroundcs.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.- Parameters:
color
- - the color to use
-
setFillBackgroundColor
public void setFillBackgroundColor(short bg)
Set the background fill color represented as a indexed color value.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 backgroundcs.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.- Specified by:
setFillBackgroundColor
in interfaceCellStyle
- Parameters:
bg
- - the color to use- See Also:
IndexedColors
-
setFillForegroundColor
public void setFillForegroundColor(XSSFColor color)
Set the foreground fill color represented as aXSSFColor
value.
Note: Ensure Foreground color is set prior to background color.- Parameters:
color
- the color to use- See Also:
)
-
setFillForegroundColor
public void setFillForegroundColor(short fg)
Set the foreground fill color as a indexed color value
Note: Ensure Foreground color is set prior to background color.- Specified by:
setFillForegroundColor
in interfaceCellStyle
- Parameters:
fg
- the color to use- See Also:
IndexedColors
-
setReadingOrder
public void setReadingOrder(ReadingOrder order)
Set reading order for the cell- Parameters:
order
- - the reading order
-
getReadingOrder
public ReadingOrder getReadingOrder()
Get reading order of the cell- Returns:
- ReadingOrder - the reading order
-
setFillPattern
public void setFillPattern(FillPatternType pattern)
This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern), foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element.- Specified by:
setFillPattern
in interfaceCellStyle
- Parameters:
pattern
- the fill pattern to use- See Also:
setFillBackgroundColor(XSSFColor)
,setFillForegroundColor(XSSFColor)
,FillPatternType
-
setFont
public void setFont(Font font)
Set the font for this style- Specified by:
setFont
in interfaceCellStyle
- Parameters:
font
- a font object created or retrieved from the XSSFWorkbook object- See Also:
XSSFWorkbook.createFont()
,XSSFWorkbook.getFontAt(short)
-
setHidden
public void setHidden(boolean hidden)
Set the cell's using this style to be hidden
-
setIndention
public void setIndention(short indent)
Set the number of spaces to indent the text in the cell- Specified by:
setIndention
in interfaceCellStyle
- Parameters:
indent
- - number of spaces
-
setLeftBorderColor
public void setLeftBorderColor(short color)
Set the color to use for the left border as a indexed color value- Specified by:
setLeftBorderColor
in interfaceCellStyle
- Parameters:
color
- the index of the color definition- See Also:
IndexedColors
-
setLeftBorderColor
public void setLeftBorderColor(XSSFColor color)
Set the color to use for the left border as aXSSFColor
value- Parameters:
color
- the color to use
-
setLocked
public void setLocked(boolean locked)
Set the cell's using this style to be locked
-
setQuotePrefixed
public 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.- Specified by:
setQuotePrefixed
in interfaceCellStyle
-
setRightBorderColor
public void setRightBorderColor(short color)
Set the color to use for the right border- Specified by:
setRightBorderColor
in interfaceCellStyle
- Parameters:
color
- the index of the color definition- See Also:
IndexedColors
-
setRightBorderColor
public void setRightBorderColor(XSSFColor color)
Set the color to use for the right border as aXSSFColor
value- Parameters:
color
- the color to use
-
setRotation
public void setRotation(short rotation)
Set the degree of rotation for the text in the cellExpressed in degrees. Values range from 0 to 180. The first letter of the text is considered the center-point of the arc.
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.
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.
- Specified by:
setRotation
in interfaceCellStyle
- Parameters:
rotation
- - the rotation degrees (between 0 and 180 degrees)
-
setTopBorderColor
public void setTopBorderColor(short color)
Set the color to use for the top border- Specified by:
setTopBorderColor
in interfaceCellStyle
- Parameters:
color
- the index of the color definition- See Also:
IndexedColors
-
setTopBorderColor
public void setTopBorderColor(XSSFColor color)
Set the color to use for the top border as aXSSFColor
value- Parameters:
color
- the color to use
-
setVerticalAlignment
public void setVerticalAlignment(VerticalAlignment align)
Set the type of vertical alignment for the cell- Specified by:
setVerticalAlignment
in interfaceCellStyle
- Parameters:
align
- - the type of alignment
-
setWrapText
public void setWrapText(boolean wrapped)
Set whether the text should be wrapped.Setting this flag to
true
make all content visible whithin a cell by displaying it on multiple lines- Specified by:
setWrapText
in interfaceCellStyle
- Parameters:
wrapped
- a boolean value indicating if the text in a cell should be line-wrapped within the cell.
-
getBorderColor
public XSSFColor getBorderColor(XSSFCellBorder.BorderSide side)
Gets border color- Parameters:
side
- the border side- Returns:
- the used color
-
setBorderColor
public void setBorderColor(XSSFCellBorder.BorderSide side, XSSFColor color)
Set the color to use for the selected border- Parameters:
side
- - where to apply the color definitioncolor
- - the color to use
-
setShrinkToFit
public void setShrinkToFit(boolean shrinkToFit)
Description copied from interface:CellStyle
Controls if the Cell should be auto-sized to shrink to fit if the text is too long- Specified by:
setShrinkToFit
in interfaceCellStyle
-
hashCode
public int hashCode()
Returns a hash code value for the object. The hash is derived from the underlying CTXf bean.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code value for this style
-
equals
public boolean equals(java.lang.Object o)
Checks is the supplied style is equal to this style- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the style to check- Returns:
- true if the supplied style is equal to this style
-
clone
public java.lang.Object clone()
Make a copy of this style. The underlying CTXf bean is cloned, the references to fills and borders remain.- Returns:
- a copy of this style
-
-