|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.hssf.usermodel.HSSFCellStyle
public final class HSSFCellStyle
High level representation of the style of a cell in a sheet of a workbook.
HSSFWorkbook.createCellStyle()
,
HSSFWorkbook.getCellStyleAt(int)
,
HSSFCell.setCellStyle(HSSFCellStyle)
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()
Deprecated. POI 3.15 beta 3. Use getAlignmentEnum() instead. |
HorizontalAlignment |
getAlignmentEnum()
get the type of horizontal alignment for the cell |
short |
getBorderBottom()
Deprecated. POI 3.15. Will return a BorderStyle enum in the future. Use getBorderBottomEnum() . |
BorderStyle |
getBorderBottomEnum()
get the type of border to use for the bottom border of the cell |
short |
getBorderLeft()
Deprecated. POI 3.15. Will return a BorderStyle enum in the future. Use getBorderLeftEnum() . |
BorderStyle |
getBorderLeftEnum()
get the type of border to use for the left border of the cell |
short |
getBorderRight()
Deprecated. POI 3.15. Will return a BorderStyle enum in the future. Use getBorderRightEnum() . |
BorderStyle |
getBorderRightEnum()
get the type of border to use for the right border of the cell |
short |
getBorderTop()
Deprecated. POI 3.15. Will return a BorderStyle enum in the future. Use getBorderTopEnum() . |
BorderStyle |
getBorderTopEnum()
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()
Deprecated. POI 3.15 beta 3. This method will return FillPatternType in the future. Use setFillPattern(FillPatternType) instead. |
FillPatternType |
getFillPatternEnum()
get the fill pattern |
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. |
boolean |
getQuotePrefixed()
Is "Quote Prefix" or "123 Prefix" enabled for the cell? |
short |
getReadingOrder()
Get the reading order, for RTL/LTR ordering of the text. |
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 |
java.lang.String |
getUserStyleName()
Gets the name of the user defined style. |
short |
getVerticalAlignment()
Deprecated. POI 3.15 beta 3. Use getVerticalAlignmentEnum() instead. |
VerticalAlignment |
getVerticalAlignmentEnum()
get the type of vertical alignment for the cell |
boolean |
getWrapText()
get whether the text should be wrapped |
int |
hashCode()
|
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 |
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 |
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(short order)
Sets the reading order, for RTL/LTR ordering of the text. |
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 Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. |
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 |
setUserStyleName(java.lang.String styleName)
Sets the name of the user defined style. |
void |
setVerticalAlignment(VerticalAlignment 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 |
---|
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, HSSFWorkbook workbook)
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, InternalWorkbook workbook)
Method Detail |
---|
public short getIndex()
getIndex
in interface CellStyle
public HSSFCellStyle getParentStyle()
public void setDataFormat(short fmt)
setDataFormat
in interface CellStyle
HSSFDataFormat
public short getDataFormat()
getDataFormat
in interface CellStyle
HSSFDataFormat
public java.lang.String getDataFormatString()
getDataFormatString
in interface CellStyle
HSSFDataFormat
public java.lang.String getDataFormatString(Workbook workbook)
HSSFDataFormat
public java.lang.String getDataFormatString(InternalWorkbook workbook)
HSSFDataFormat
public void setFont(Font font)
setFont
in interface CellStyle
font
- a font object created or retrieved from the HSSFWorkbook objectHSSFWorkbook.createFont()
,
HSSFWorkbook.getFontAt(short)
public void setFont(HSSFFont font)
public short getFontIndex()
getFontIndex
in interface CellStyle
HSSFWorkbook.getFontAt(short)
public HSSFFont getFont(Workbook parentWorkbook)
parentWorkbook
- The HSSFWorkbook that this style belongs togetFontIndex()
,
HSSFWorkbook.getFontAt(short)
public void setHidden(boolean hidden)
setHidden
in interface CellStyle
hidden
- - whether the cell using this style should be hiddenpublic boolean getHidden()
getHidden
in interface CellStyle
public void setLocked(boolean locked)
setLocked
in interface CellStyle
locked
- - whether the cell using this style should be lockedpublic boolean getLocked()
getLocked
in interface CellStyle
public void setQuotePrefixed(boolean quotePrefix)
setQuotePrefixed
in interface CellStyle
public boolean getQuotePrefixed()
getQuotePrefixed
in interface CellStyle
public void setAlignment(HorizontalAlignment align)
setAlignment
in interface CellStyle
align
- - the type of alignment@Deprecated public short getAlignment()
getAlignmentEnum()
instead.
getAlignment
in interface CellStyle
public HorizontalAlignment getAlignmentEnum()
getAlignmentEnum
in interface CellStyle
public void setWrapText(boolean wrapped)
setWrapText
in interface CellStyle
wrapped
- wrap text or notpublic boolean getWrapText()
getWrapText
in interface CellStyle
public void setVerticalAlignment(VerticalAlignment align)
setVerticalAlignment
in interface CellStyle
align
- the type of alignment@Deprecated public short getVerticalAlignment()
getVerticalAlignmentEnum()
instead.
getVerticalAlignment
in interface CellStyle
VerticalAlignment
public VerticalAlignment getVerticalAlignmentEnum()
getVerticalAlignmentEnum
in interface CellStyle
public void setRotation(short rotation)
setRotation
in interface CellStyle
rotation
- degrees (between -90 and 90 degrees, of 0xff for vertical)public short getRotation()
getRotation
in interface CellStyle
public void setIndention(short indent)
setIndention
in interface CellStyle
indent
- - number of spacespublic short getIndention()
getIndention
in interface CellStyle
public void setBorderLeft(BorderStyle border)
setBorderLeft
in interface CellStyle
border
- type@Deprecated public short getBorderLeft()
getBorderLeftEnum()
.
getBorderLeft
in interface CellStyle
public BorderStyle getBorderLeftEnum()
getBorderLeftEnum
in interface CellStyle
public void setBorderRight(BorderStyle border)
setBorderRight
in interface CellStyle
border
- type@Deprecated public short getBorderRight()
getBorderRightEnum()
.
getBorderRight
in interface CellStyle
public BorderStyle getBorderRightEnum()
getBorderRightEnum
in interface CellStyle
public void setBorderTop(BorderStyle border)
setBorderTop
in interface CellStyle
border
- type@Deprecated public short getBorderTop()
getBorderTopEnum()
.
getBorderTop
in interface CellStyle
public BorderStyle getBorderTopEnum()
getBorderTopEnum
in interface CellStyle
public void setBorderBottom(BorderStyle border)
setBorderBottom
in interface CellStyle
border
- type@Deprecated public short getBorderBottom()
getBorderBottomEnum()
.
getBorderBottom
in interface CellStyle
public BorderStyle getBorderBottomEnum()
getBorderBottomEnum
in interface CellStyle
public void setLeftBorderColor(short color)
setLeftBorderColor
in interface CellStyle
color
- The index of the color definitionpublic short getLeftBorderColor()
getLeftBorderColor
in interface CellStyle
HSSFPalette.getColor(short)
public void setRightBorderColor(short color)
setRightBorderColor
in interface CellStyle
color
- The index of the color definitionpublic short getRightBorderColor()
getRightBorderColor
in interface CellStyle
HSSFPalette.getColor(short)
public void setTopBorderColor(short color)
setTopBorderColor
in interface CellStyle
color
- The index of the color definitionpublic short getTopBorderColor()
getTopBorderColor
in interface CellStyle
HSSFPalette.getColor(short)
public void setBottomBorderColor(short color)
setBottomBorderColor
in interface CellStyle
color
- The index of the color definitionpublic short getBottomBorderColor()
getBottomBorderColor
in interface CellStyle
HSSFPalette.getColor(short)
public void setFillPattern(FillPatternType fp)
setFillPattern
in interface CellStyle
fp
- fill pattern (set to FillPatternType.SOLID_FOREGROUND
to fill w/foreground color)@Deprecated public short getFillPattern()
FillPatternType
in the future. Use setFillPattern(FillPatternType)
instead.
getFillPattern
in interface CellStyle
public FillPatternType getFillPatternEnum()
getFillPatternEnum
in interface CellStyle
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.
setFillBackgroundColor
in interface CellStyle
bg
- colorpublic short getFillBackgroundColor()
getFillForegroundColor()
getFillBackgroundColor
in interface CellStyle
HSSFPalette.getColor(short)
public HSSFColor getFillBackgroundColorColor()
CellStyle
getFillBackgroundColorColor
in interface CellStyle
public void setFillForegroundColor(short bg)
setFillForegroundColor
in interface CellStyle
bg
- colorpublic short getFillForegroundColor()
getFillBackgroundColor()
)
getFillForegroundColor
in interface CellStyle
HSSFPalette.getColor(short)
public HSSFColor getFillForegroundColorColor()
CellStyle
getFillForegroundColorColor
in interface CellStyle
public java.lang.String getUserStyleName()
public void setUserStyleName(java.lang.String styleName)
public void setShrinkToFit(boolean shrinkToFit)
setShrinkToFit
in interface CellStyle
public boolean getShrinkToFit()
getShrinkToFit
in interface CellStyle
public short getReadingOrder()
0 means Context (Default), 1 means Left To Right, and 2 means Right to Left
public void setReadingOrder(short order)
0 means Context (Default), 1 means Left To Right, and 2 means Right to Left
order
- - the reading order (0,1,2)public void verifyBelongsToWorkbook(HSSFWorkbook wb)
java.lang.IllegalArgumentException
- if there's a workbook mis-matchpublic void cloneStyleFrom(CellStyle source)
cloneStyleFrom
in interface CellStyle
public void cloneStyleFrom(HSSFCellStyle source)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |