public final class HSSFCellStyle extends java.lang.Object implements CellStyle, Duplicatable
Modifier | Constructor and Description |
---|---|
protected |
HSSFCellStyle(HSSFCellStyle other) |
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) |
Modifier and Type | Method and Description |
---|---|
void |
cloneStyleFrom(CellStyle source)
Clones all the style information from another HSSFCellStyle, onto this one.
(将另一个 HSSFCellStyle 中的所有样式信息克隆到这个上。)
|
void |
cloneStyleFrom(HSSFCellStyle source) |
HSSFCellStyle |
copy() |
boolean |
equals(java.lang.Object obj) |
HorizontalAlignment |
getAlignment()
get the type of horizontal alignment for the cell
(获取单元格的水平对齐类型)
|
BorderStyle |
getBorderBottom()
get the type of border to use for the bottom border of the cell
(获取用于单元格底部边框的边框类型)
|
BorderStyle |
getBorderLeft()
get the type of border to use for the left border of the cell
(获取用于单元格左边框的边框类型)
|
BorderStyle |
getBorderRight()
get the type of border to use for the right border of the cell
(获取用于单元格右边框的边框类型)
|
BorderStyle |
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
(通过针对绑定的工作簿查找 DataFormat 来获取格式字符串的内容)
|
java.lang.String |
getDataFormatString(InternalWorkbook workbook)
Get the contents of the format string, by looking up the DataFormat against the supplied low level workbook
(通过针对提供的低级工作簿查找 DataFormat 来获取格式字符串的内容)
|
java.lang.String |
getDataFormatString(Workbook workbook)
Get the contents of the format string, by looking up the DataFormat against the supplied workbook
(通过针对提供的工作簿查找 DataFormat 来获取格式字符串的内容)
|
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.
(获取表示当前前景填充的颜色对象,使用提供的工作簿解析索引。)
|
FillPatternType |
getFillPattern()
Get the fill pattern
(获取填充图案)
|
HSSFFont |
getFont(Workbook parentWorkbook)
gets the font for this style
(获取此样式的字体)
|
int |
getFontIndex()
gets the index of the font for this style
(获取此样式的字体索引)
|
int |
getFontIndexAsInt()
|
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)
(获取 HSSFWorkbook 中的索引(ExtnededFormat 对象集合中的序列))
|
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?
(单元格是否启用了“引用前缀”或“123 前缀”?)
|
short |
getReadingOrder()
Get the reading order, for RTL/LTR ordering of the text.
(获取阅读顺序,用于文本的 RTL/LTR 排序。)
|
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?
(如果此文本太长,是否应该由 Excel 自动调整单元格以缩小它以适应?)
|
short |
getTopBorderColor()
get the color to use for the top border
(获取用于上边框的颜色)
|
java.lang.String |
getUserStyleName()
Gets the name of the user defined style.
(获取用户定义样式的名称。)
|
VerticalAlignment |
getVerticalAlignment()
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...
(设置为 1 用前景色填充单元格...)
|
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.
(打开或关闭样式的“引用前缀”或“123 前缀”,用于告诉 Excel 不应将看起来像数字或公式的东西视为打开。)
|
void |
setReadingOrder(short order)
Sets the reading order, for RTL/LTR ordering of the text.
(设置阅读顺序,用于文本的 RTL/LTR 排序。)
|
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.
(设置单元格中文本的旋转度数 注意:HSSF 使用 -90 到 90 度的值,而 XSSF 使用 0 到 180 度的值。)
|
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.
(验证此样式是否属于提供的工作簿。)
|
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, HSSFWorkbook workbook)
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, InternalWorkbook workbook)
protected HSSFCellStyle(HSSFCellStyle other)
public short getIndex()
public HSSFCellStyle getParentStyle()
public void setDataFormat(short fmt)
setDataFormat
in interface
CellStyle
(接口 CellStyle 中的 setDataFormat)
HSSFDataFormat
public short getDataFormat()
getDataFormat
in interface
CellStyle
(接口 CellStyle 中的 getDataFormat)
HSSFDataFormat
public java.lang.String getDataFormatString()
getDataFormatString
in interface
CellStyle
(接口 CellStyle 中的 getDataFormatString)
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
(接口 CellStyle 中的 setFont)
font
- a font object created or retrieved from the HSSFWorkbook object
(font - 从 HSSFWorkbook 对象创建或检索的字体对象)
HSSFWorkbook.createFont()
,
HSSFWorkbook.getFontAt(int)
public void setFont(HSSFFont font)
public int getFontIndex()
getFontIndex
in interface
CellStyle
(接口 CellStyle 中的 getFontIndex)
HSSFWorkbook.getFontAt(int)
@Deprecated @Removal(version="6.0.0") public int getFontIndexAsInt()
getFontIndex()
instead
getFontIndexAsInt
in interface
CellStyle
(接口 CellStyle 中的 getFontIndexAsInt)
HSSFWorkbook.getFontAt(int)
public HSSFFont getFont(Workbook parentWorkbook)
parentWorkbook
- The HSSFWorkbook that this style belongs to
(parentWorkbook - 此样式所属的 HSSFWorkbook)
getFontIndex()
,
HSSFWorkbook.getFontAt(int)
public void setHidden(boolean hidden)
public boolean getHidden()
public void setLocked(boolean locked)
public boolean getLocked()
public void setQuotePrefixed(boolean quotePrefix)
setQuotePrefixed
in interface
CellStyle
(接口 CellStyle 中的 setQuotePrefixed)
public boolean getQuotePrefixed()
getQuotePrefixed
in interface
CellStyle
(接口 CellStyle 中的 getQuotePrefixed)
public void setAlignment(HorizontalAlignment align)
setAlignment
in interface
CellStyle
(接口 CellStyle 中的 setAlignment)
align
- - the type of alignment
(align - - 对齐类型)
public HorizontalAlignment getAlignment()
CellStyle
getAlignment
in interface
CellStyle
(接口 CellStyle 中的 getAlignment)
public void setWrapText(boolean wrapped)
setWrapText
in interface
CellStyle
(接口 CellStyle 中的 setWrapText)
wrapped
- wrap text or not
(Wrapped - 是否换行)
public boolean getWrapText()
getWrapText
in interface
CellStyle
(接口 CellStyle 中的 getWrapText)
public void setVerticalAlignment(VerticalAlignment align)
setVerticalAlignment
in interface
CellStyle
(接口 CellStyle 中的 setVerticalAlignment)
align
- the type of alignment
(align - 对齐的类型)
public VerticalAlignment getVerticalAlignment()
CellStyle
getVerticalAlignment
in interface
CellStyle
(接口 CellStyle 中的 getVerticalAlignment)
public void setRotation(short rotation)
setRotation
in interface
CellStyle
(界面 CellStyle 中的 setRotation)
rotation
- degrees (between -90 and 90 degrees, of 0xff for vertical)
(旋转 - 度数(在 -90 到 90 度之间,垂直方向为 0xff))
public short getRotation()
getRotation
in interface
CellStyle
(接口 CellStyle 中的 getRotation)
public void setIndention(short indent)
setIndention
in interface
CellStyle
(接口 CellStyle 中的 setIndention)
indent
- - number of spaces
(缩进 - - 空格数)
public short getIndention()
getIndention
in interface
CellStyle
(接口 CellStyle 中的 getIndention)
public void setBorderLeft(BorderStyle border)
setBorderLeft
in interface
CellStyle
(接口 CellStyle 中的 setBorderLeft)
border
- type
(边框类型)
public BorderStyle getBorderLeft()
CellStyle
getBorderLeft
in interface
CellStyle
(接口 CellStyle 中的 getBorderLeft)
public void setBorderRight(BorderStyle border)
setBorderRight
in interface
CellStyle
(接口 CellStyle 中的 setBorderRight)
border
- type
(边框类型)
public BorderStyle getBorderRight()
CellStyle
getBorderRight
in interface
CellStyle
(接口 CellStyle 中的 getBorderRight)
public void setBorderTop(BorderStyle border)
setBorderTop
in interface
CellStyle
(接口 CellStyle 中的 setBorderTop)
border
- type
(边框类型)
public BorderStyle getBorderTop()
CellStyle
getBorderTop
in interface
CellStyle
(接口 CellStyle 中的 getBorderTop)
public void setBorderBottom(BorderStyle border)
setBorderBottom
in interface
CellStyle
(接口 CellStyle 中的 setBorderBottom)
border
- type
(边框类型)
public BorderStyle getBorderBottom()
CellStyle
getBorderBottom
in interface
CellStyle
(接口 CellStyle 中的 getBorderBottom)
public void setLeftBorderColor(short color)
setLeftBorderColor
in interface
CellStyle
(接口 CellStyle 中的 setLeftBorderColor)
color
- The index of the color definition
(color - 颜色定义的索引)
public short getLeftBorderColor()
getLeftBorderColor
in interface
CellStyle
(接口 CellStyle 中的 getLeftBorderColor)
HSSFPalette.getColor(short)
public void setRightBorderColor(short color)
setRightBorderColor
in interface
CellStyle
(接口 CellStyle 中的 setRightBorderColor)
color
- The index of the color definition
(color - 颜色定义的索引)
public short getRightBorderColor()
getRightBorderColor
in interface
CellStyle
(接口 CellStyle 中的 getRightBorderColor)
HSSFPalette.getColor(short)
public void setTopBorderColor(short color)
setTopBorderColor
in interface
CellStyle
(接口 CellStyle 中的 setTopBorderColor)
color
- The index of the color definition
(color - 颜色定义的索引)
public short getTopBorderColor()
getTopBorderColor
in interface
CellStyle
(接口 CellStyle 中的 getTopBorderColor)
HSSFPalette.getColor(short)
public void setBottomBorderColor(short color)
setBottomBorderColor
in interface
CellStyle
(接口 CellStyle 中的 setBottomBorderColor)
color
- The index of the color definition
(color - 颜色定义的索引)
public short getBottomBorderColor()
getBottomBorderColor
in interface
CellStyle
(接口 CellStyle 中的 getBottomBorderColor)
HSSFPalette.getColor(short)
public void setFillPattern(FillPatternType fp)
setFillPattern
in interface
CellStyle
(接口 CellStyle 中的 setFillPattern)
fp
- fill pattern (set to
FillPatternType.SOLID_FOREGROUND
to fill w/foreground color)
(fp - 填充图案(设置为 FillPatternType.SOLID_FOREGROUND 以填充前景色))
public FillPatternType getFillPattern()
CellStyle
getFillPattern
in interface
CellStyle
(接口 CellStyle 中的 getFillPattern)
FillPatternType.NO_FILL
(填充图案,默认值为 FillPatternType.NO_FILL)
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. (设置背景填充颜色。例如:cs.setFillPattern(HSSFCellStyle.FINE_DOTS); cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());可以选择应用前景和背景填充:注意:确保在背景之前设置前景色 cs.setFillPattern(HSSFCellStyle.FINE_DOTS ); cs.setFillForegroundColor(new HSSFColor.BLUE().getIndex()); cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());或者,对于 SOLID_FILL 的特殊情况: cs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND ); cs.setFillForegroundColor(new HSSFColor.RED().getIndex());必须设置填充样式才能在单元格中显示颜色。)
setFillBackgroundColor
in interface
CellStyle
(接口 CellStyle 中的 setFillBackgroundColor)
bg
- color
(bg - 颜色)
public short getFillBackgroundColor()
getFillForegroundColor()
(获取背景填充颜色。注意 - 许多单元格实际上填充了前景填充,而不是背景填充 - 请参阅 getFillForegroundColor())
getFillBackgroundColor
in interface
CellStyle
(接口 CellStyle 中的 getFillBackgroundColor)
HSSFPalette.getColor(short)
public HSSFColor getFillBackgroundColorColor()
CellStyle
getFillBackgroundColorColor
in interface
CellStyle
(接口 CellStyle 中的 getFillBackgroundColorColor)
public void setFillForegroundColor(short bg)
setFillForegroundColor
in interface
CellStyle
(接口 CellStyle 中的 setFillForegroundColor)
bg
- color
(bg - 颜色)
public short getFillForegroundColor()
getFillBackgroundColor()
)
(获取前景填充颜色。许多单元格都用这个填充,而不是背景颜色 (getFillBackgroundColor()))
getFillForegroundColor
in interface
CellStyle
(接口 CellStyle 中的 getFillForegroundColor)
HSSFPalette.getColor(short)
public HSSFColor getFillForegroundColorColor()
CellStyle
getFillForegroundColorColor
in interface
CellStyle
(接口 CellStyle 中的 getFillForegroundColorColor)
public java.lang.String getUserStyleName()
public void setUserStyleName(java.lang.String styleName)
public void setShrinkToFit(boolean shrinkToFit)
setShrinkToFit
in interface
CellStyle
(接口 CellStyle 中的 setShrinkToFit)
public boolean getShrinkToFit()
getShrinkToFit
in interface
CellStyle
(接口 CellStyle 中的 getShrinkToFit)
public short getReadingOrder()
0 means Context (Default), 1 means Left To Right, and 2 means Right to Left
(获取阅读顺序,用于文本的 RTL/LTR 排序。 0 表示上下文(默认),1 表示从左到右,2 表示从右到左)public void setReadingOrder(short order)
0 means Context (Default), 1 means Left To Right, and 2 means Right to Left
(设置阅读顺序,用于文本的 RTL/LTR 排序。 0 表示上下文(默认),1 表示从左到右,2 表示从右到左)order
- - the reading order (0,1,2)
(order - - 阅读顺序 (0,1,2))
public void verifyBelongsToWorkbook(HSSFWorkbook wb)
java.lang.IllegalArgumentException
- if there's a workbook mis-match
(java.lang.IllegalArgumentException - 如果工作簿不匹配)
public void cloneStyleFrom(CellStyle source)
cloneStyleFrom
in interface
CellStyle
(接口 CellStyle 中的 cloneStyleFrom)
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
public HSSFCellStyle copy()
copy
in interface
Duplicatable
(复制到界面 Duplicatable)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.