Row.MissingCellPolicy
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_CAPACITY |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<Cell> |
cellIterator() |
int |
compareTo(HSSFRow other)
Compares two
HSSFRow objects.
(比较两个 HSSFRow 对象。)
|
HSSFCell |
createCell(int column)
Use this to create new cells within the row and return it.
(使用它在行内创建新单元格并将其返回。)
|
HSSFCell |
createCell(int columnIndex, CellType type)
Use this to create new cells within the row and return it.
(使用它在行内创建新单元格并将其返回。)
|
boolean |
equals(java.lang.Object obj) |
HSSFCell |
getCell(int cellnum)
Get the hssfcell representing a given column (logical cell) 0-based.
(获取表示给定列(逻辑单元)的 hssfcell,从 0 开始。)
|
HSSFCell |
getCell(int cellnum, Row.MissingCellPolicy policy)
Get the hssfcell representing a given column (logical cell) 0-based.
(获取表示给定列(逻辑单元)的 hssfcell,从 0 开始。)
|
short |
getFirstCellNum()
get the number of the first cell contained in this row.
(获取此行中包含的第一个单元格的编号。)
|
short |
getHeight()
get the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point)
(获取行的高度或 ff (-1) 以缇为单位的未定义/默认高度(点的 1/20))
|
float |
getHeightInPoints()
get the row's height or ff (-1) for undefined/default-height in points (20*getHeight())
(获取行的高度或 ff (-1) 以点为单位的未定义/默认高度 (20*getHeight()))
|
short |
getLastCellNum()
Gets the index of the last cell contained in this row
PLUS ONE.
(获取此行 PLUS ONE 中包含的最后一个单元格的索引。)
|
int |
getOutlineLevel()
Returns the rows outline level.
(返回行大纲级别。)
|
int |
getPhysicalNumberOfCells()
gets the number of defined cells (NOT number of cells in the actual row!).
(获取已定义单元格的数量(不是实际行中的单元格数量!)。)
|
int |
getRowNum()
get row number this row represents
(获取该行代表的行号)
|
protected RowRecord |
getRowRecord()
get the lowlevel RowRecord represented by this object - should only be called by other parts of the high level API
(获取此对象表示的低级 RowRecord - 只能由高级 API 的其他部分调用)
|
HSSFCellStyle |
getRowStyle()
Returns the whole-row cell styles.
(返回整行单元格样式。)
|
HSSFSheet |
getSheet()
Returns the HSSFSheet this row belongs to
(返回此行所属的 HSSFSheet)
|
boolean |
getZeroHeight()
get whether or not to display this row with 0 height
(获取是否以 0 高度显示该行)
|
int |
hashCode() |
boolean |
isFormatted()
Is this row formatted? Most aren't, but some rows do have whole-row styles.
(此行是否已格式化?大多数不是,但有些行确实具有整行样式。)
|
java.util.Iterator<Cell> |
iterator()
Alias for
cellIterator() to allow foreach loops
(允许 foreach 循环的 cellIterator() 的别名)
|
void |
moveCell(HSSFCell cell, short newColumn)
Moves the supplied cell to a new column, which must not already have a cell there!
(将提供的单元格移动到一个新列,该列必须没有单元格!)
|
protected void |
removeAllCells()
Removes all the cells from the row, and their records too.
(从行中删除所有单元格,以及它们的记录。)
|
void |
removeCell(Cell cell)
remove the HSSFCell from this row.
(从此行中删除 HSSFCell。)
|
void |
setHeight(short height)
set the row's height or set to ff (-1) for undefined/default-height.
(为未定义/默认高度设置行的高度或设置为 ff (-1)。)
|
void |
setHeightInPoints(float height)
set the row's height in points.
(以点为单位设置行高。)
|
void |
setRowNum(int rowIndex)
set the row number of this row.
(设置该行的行号。)
|
void |
setRowStyle(CellStyle style)
Applies a whole-row cell styling to the row.
(将整行单元格样式应用于行。)
|
void |
setRowStyle(HSSFCellStyle style)
Applies a whole-row cell styling to the row.
(将整行单元格样式应用于行。)
|
void |
setZeroHeight(boolean zHeight)
set whether or not to display this row with 0 height
(设置是否以 0 高度显示该行)
|
void |
shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the left.
(将列范围 [firstShiftColumnIndex-lastShiftColumnIndex] 步骤位置向左移动。)
|
void |
shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
Shifts column range [firstShiftColumnIndex-lastShiftColumnIndex] step places to the right.
(将列范围 [firstShiftColumnIndex-lastShiftColumnIndex] 步骤位置向右移动。)
|
public HSSFCell createCell(int column)
The cell that is returned is a CellType.BLANK
. The type can be changed either through calling setCellValue
or setCellType
.
createCell
in interface
Row
(接口 Row 中的 createCell)
column
- - the column number this cell represents
(column - - 此单元格代表的列号)
java.lang.IllegalArgumentException
- if columnIndex < 0 or greater than 255, the maximum number of columns supported by the Excel binary format (.xls)
(java.lang.IllegalArgumentException - 如果 columnIndex < 0 或大于 255,则 Excel 二进制格式 (.xls) 支持的最大列数)
public HSSFCell createCell(int columnIndex, CellType type)
The cell that is returned will be of the requested type. The type can be changed either through calling setCellValue or setCellType, but there is a small overhead to doing this, so it is best to create the required type up front.
(使用它在行内创建新单元格并将其返回。返回的单元格将是请求的类型。可以通过调用 setCellValue 或 setCellType 来更改类型,但这样做会产生少量开销,因此最好预先创建所需的类型。)createCell
in interface
Row
(接口 Row 中的 createCell)
columnIndex
- - the column number this cell represents
(columnIndex - - 此单元格代表的列号)
type
- - the cell's data type
(type - - 单元格的数据类型)
java.lang.IllegalArgumentException
- if columnIndex < 0 or greater than 255, the maximum number of columns supported by the Excel binary format (.xls)
(java.lang.IllegalArgumentException - 如果 columnIndex < 0 或大于 255,则 Excel 二进制格式 (.xls) 支持的最大列数)
public void removeCell(Cell cell)
removeCell
in interface
Row
(接口 Row 中的 removeCell)
cell
- to remove
(单元格 - 删除)
protected void removeAllCells()
public void setRowNum(int rowIndex)
public int getRowNum()
public HSSFSheet getSheet()
public int getOutlineLevel()
getOutlineLevel
in interface
Row
(接口 Row 中的 getOutlineLevel)
public void moveCell(HSSFCell cell, short newColumn)
cell
- The cell to move
(cell - 要移动的单元格)
newColumn
- The new column number (0 based)
(newColumn - 新列号(从 0 开始))
public HSSFCell getCell(int cellnum)
Row.MissingCellPolicy
on the base workbook.
(获取表示给定列(逻辑单元)的 hssfcell,从 0 开始。如果您要求一个未定义的单元格,那么您会得到一个空值,除非您在基本工作簿上设置了不同的 Row.MissingCellPolicy。)
getCell
in interface
Row
(接口 Row 中的 getCell)
cellnum
- 0 based column number
(cellnum - 基于 0 的列号)
Row.getCell(int, org.apache.poi.ss.usermodel.Row.MissingCellPolicy)
public HSSFCell getCell(int cellnum, Row.MissingCellPolicy policy)
public short getFirstCellNum()
getFirstCellNum
in interface
Row
(接口 Row 中的 getFirstCellNum)
public short getLastCellNum()
short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for(short colIx=minColIx; colIx<maxColIx; colIx++) { HSSFCell cell = row.getCell(colIx); if(cell == null) { continue; } //... do something with cell }(获取此行 PLUS ONE 中包含的最后一个单元格的索引。结果也恰好是最后一个单元格的基于 1 的列号。迭代单元格时,此值可用作标准上限: short minColIx = row.getFirstCellNum();短 maxColIx = row.getLastCellNum();对于(短 colIx=minColIx;colIx
getLastCellNum
in interface
Row
(接口 Row 中的 getLastCellNum)
public int getPhysicalNumberOfCells()
getPhysicalNumberOfCells
in interface
Row
(接口 Row 中的 getPhysicalNumberOfCells)
public void setHeight(short height)
public void setZeroHeight(boolean zHeight)
setZeroHeight
in interface
Row
(接口 Row 中的 setZeroHeight)
zHeight
- height is zero or not.
(zHeight - 高度是否为零。)
public boolean getZeroHeight()
getZeroHeight
in interface
Row
(接口 Row 中的 getZeroHeight)
public void setHeightInPoints(float height)
setHeightInPoints
in interface
Row
(接口 Row 中的 setHeightInPoints)
height
- row height in points,
-1
means to use the default height
(height - 以磅为单位的行高,-1 表示使用默认高度)
public short getHeight()
public float getHeightInPoints()
getHeightInPoints
in interface
Row
(接口 Row 中的 getHeightInPoints)
Sheet.getDefaultRowHeightInPoints()
protected RowRecord getRowRecord()
public boolean isFormatted()
getRowStyle()
(此行是否已格式化?大多数不是,但有些行确实具有整行样式。对于那些这样做的人,您可以从 getRowStyle() 获取格式)
isFormatted
in interface
Row
(isFormatted 在接口 Row 中)
public HSSFCellStyle getRowStyle()
isFormatted()
to check first.
(返回整行单元格样式。大多数行不会有其中之一,因此将返回 null。首先调用 isFormatted() 进行检查。)
getRowStyle
in interface
Row
(接口 Row 中的 getRowStyle)
public void setRowStyle(HSSFCellStyle style)
public void setRowStyle(CellStyle style)
setRowStyle
in interface
Row
(接口 Row 中的 setRowStyle)
public java.util.Iterator<Cell> cellIterator()
cellIterator
in interface
Row
(接口 Row 中的 cellIterator)
Row.MissingCellPolicy
has no effect.
(物理定义单元的单元迭代器。请注意,第 4 个元素可能不是单元格 4,因为迭代器不会返回未定义(空)的单元格。在返回的单元格上调用 getCellNum() 以了解它们是哪个单元格。由于这只适用于物理定义的单元格,因此 Row.MissingCellPolicy 无效。)
public java.util.Iterator<Cell> iterator()
cellIterator()
to allow foreach loops
(允许 foreach 循环的 cellIterator() 的别名)
iterator
in interface
java.lang.Iterable<Cell>
(接口 java.lang.Iterable 中的迭代器
public int compareTo(HSSFRow other)
HSSFRow
objects. Two rows are equal if they belong to the same worksheet and their row indexes are equal.
(比较两个 HSSFRow 对象。如果两行属于同一个工作表并且它们的行索引相等,则它们是相等的。)
compareTo
in interface
java.lang.Comparable<HSSFRow>
(接口 java.lang.Comparable 中的 compareTo
other
- the
HSSFRow
to be compared.
(other - 要比较的 HSSFRow。)
0
if the row number of this HSSFRow
is equal to the row number of the argument HSSFRow
0
if the row number of this this HSSFRow
is numerically less than the row number of the argument HSSFRow
0
if the row number of this this HSSFRow
is numerically greater than the row number of the argument HSSFRow
java.lang.IllegalArgumentException
- if the argument row belongs to a different worksheet
(java.lang.IllegalArgumentException - 如果参数行属于不同的工作表)
public boolean equals(java.lang.Object obj)
equals
in class
java.lang.Object
public int hashCode()
hashCode
in class
java.lang.Object
public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
shiftCellsRight
in interface
Row
(界面 Row 中的 shiftCellsRight)
firstShiftColumnIndex
- the column to start shifting
(firstShiftColumnIndex - 开始移动的列)
lastShiftColumnIndex
- the column to end shifting
(lastShiftColumnIndex - 结束移位的列)
step
- length of the shifting step
(step - 移动步长)
public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
shiftCellsLeft
in interface
Row
(接口 Row 中的 shiftCellsLeft)
firstShiftColumnIndex
- the column to start shifting
(firstShiftColumnIndex - 开始移动的列)
lastShiftColumnIndex
- the column to end shifting
(lastShiftColumnIndex - 结束移位的列)
step
- length of the shifting step
(step - 移动步长)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.