Row.MissingCellPolicy
Modifier | Constructor and Description |
---|---|
protected |
XSSFRow(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow row, XSSFSheet sheet)
Construct a XSSFRow.
(构造一个 XSSFRow。)
|
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<Cell> |
cellIterator()
Cell iterator over the physically defined cells:
(物理定义单元上的单元迭代器:)
|
int |
compareTo(XSSFRow other)
Compares two
XSSFRow objects.
(比较两个 XSSFRow 对象。)
|
void |
copyRowFrom(Row srcRow, CellCopyPolicy policy)
Copy the cells from srcRow to this row If this row is not a blank row, this will merge the two rows, overwriting the cells in this row with the cells in srcRow If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy srcRow may be from a different sheet in the same workbook
(将 srcRow 中的单元格复制到该行 如果该行不是空白行,这将合并两行,用 srcRow 中的单元格覆盖该行中的单元格 如果 srcRow 为空,则用空白值、样式覆盖目标行中的单元格等每个单元格复制策略 srcRow 可能来自同一工作簿中的不同工作表)
|
XSSFCell |
createCell(int columnIndex)
Use this to create new cells within the row and return it.
(使用它在行内创建新单元格并将其返回。)
|
XSSFCell |
createCell(int columnIndex, CellType type)
Use this to create new cells within the row and return it.
(使用它在行内创建新单元格并将其返回。)
|
boolean |
equals(java.lang.Object obj) |
XSSFCell |
getCell(int cellnum)
Returns the cell at the given (0 based) index, with the
Row.MissingCellPolicy from the parent Workbook.
(使用父工作簿中的 Row.MissingCellPolicy 返回给定(基于 0)索引处的单元格。)
|
XSSFCell |
getCell(int cellnum, Row.MissingCellPolicy policy)
Returns the cell at the given (0 based) index, with the specified
Row.MissingCellPolicy
(返回给定(基于 0)索引处的单元格,具有指定的 Row.MissingCellPolicy)
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow |
getCTRow()
Returns the underlying CTRow xml bean containing all cell definitions in this row
(返回包含此行中所有单元格定义的底层 CTRow xml bean)
|
short |
getFirstCellNum()
Get the 0-based number of the first cell contained in this row.
(获取此行中包含的第一个单元格的从 0 开始的编号。)
|
short |
getHeight()
Get the row's height measured in twips (1/20th of a point).
(获取以缇为单位的行高(1/20 点)。)
|
float |
getHeightInPoints()
Returns row height measured in point size.
(返回以磅为单位测量的行高。)
|
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
(获取此行代表的行号)
|
XSSFCellStyle |
getRowStyle()
Returns the whole-row cell style.
(返回整行单元格样式。)
|
XSSFSheet |
getSheet()
Returns the XSSFSheet this row belongs to
(返回此行所属的 XSSFSheet)
|
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() 的别名:)
|
protected void |
onDocumentWrite()
Fired when the document is written to an output stream.
(当文档写入输出流时触发。)
|
void |
removeCell(Cell cell)
Remove the Cell from this row.
(从此行中删除单元格。)
|
void |
setHeight(short height)
Set the height in "twips" or 1/20th of a point.
(以“缇”或点的 1/20 为单位设置高度。)
|
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 |
setZeroHeight(boolean height)
Set whether or not to display this row with 0 height
(设置是否以0高度显示该行)
|
protected void |
shift(int n)
update cell references when shifting rows
(移动行时更新单元格引用)
|
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] 步骤位置向右移动。)
|
java.lang.String |
toString() |
protected XSSFRow(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow row, XSSFSheet sheet)
row
- the xml bean containing all cell definitions for this row.
(row - 包含此行的所有单元格定义的 xml bean。)
sheet
- the parent sheet.
(sheet - 父表。)
public XSSFSheet getSheet()
public java.util.Iterator<Cell> cellIterator()
(物理定义单元格上的单元格迭代器: for (Iterator it = row.cellIterator(); it.hasNext(); ) { Cell cell = it.next(); ... })for (Iteratorit = row.cellIterator(); it.hasNext(); ) { Cell cell = it.next(); ... } |
cellIterator
in interface
Row
(接口 Row 中的 cellIterator)
public java.util.Iterator<Cell> iterator()
cellIterator()
to allow foreach loops:
(允许 foreach 循环的 cellIterator() 的别名:for(Cell cell : row){ ... })for(Cell cell : row){ ... }
iterator
in interface
java.lang.Iterable<Cell>
(接口 java.lang.Iterable 中的迭代器
public int compareTo(XSSFRow other)
XSSFRow
objects. Two rows are equal if they belong to the same worksheet and their row indexes are equal.
(比较两个 XSSFRow 对象。如果两行属于同一个工作表并且它们的行索引相等,则它们是相等的。)
compareTo
in interface
java.lang.Comparable<XSSFRow>
(接口 java.lang.Comparable 中的 compareTo
other
- the
XSSFRow
to be compared.
(other - 要比较的 XSSFRow。)
0
if the row number of this XSSFRow
is equal to the row number of the argument XSSFRow
0
if the row number of this this XSSFRow
is numerically less than the row number of the argument XSSFRow
0
if the row number of this this XSSFRow
is numerically greater than the row number of the argument XSSFRow
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 XSSFCell createCell(int columnIndex)
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)
columnIndex
- - the column number this cell represents
(columnIndex - - 此单元格代表的列号)
java.lang.IllegalArgumentException
- if columnIndex < 0 or greater than 16384, the maximum number of columns supported by the SpreadsheetML format (.xlsx)
(java.lang.IllegalArgumentException - 如果 columnIndex < 0 或大于 16384,SpreadsheetML 格式 (.xlsx) 支持的最大列数)
public XSSFCell createCell(int columnIndex, CellType type)
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 the specified cell type is invalid, columnIndex < 0 or greater than 16384, the maximum number of columns supported by the SpreadsheetML format (.xlsx)
(java.lang.IllegalArgumentException - 如果指定的单元格类型无效,columnIndex < 0 或大于 16384,SpreadsheetML 格式 (.xlsx) 支持的最大列数)
public XSSFCell getCell(int cellnum)
Row.MissingCellPolicy
from the parent Workbook.
(使用父工作簿中的 Row.MissingCellPolicy 返回给定(基于 0)索引处的单元格。)
getCell
in interface
Row
(接口 Row 中的 getCell)
cellnum
- 0 based column number
(cellnum - 基于 0 的列号)
Row.getCell(int, org.apache.poi.ss.usermodel.Row.MissingCellPolicy)
public XSSFCell getCell(int cellnum, Row.MissingCellPolicy policy)
Row.MissingCellPolicy
(返回给定(基于 0)索引处的单元格,具有指定的 Row.MissingCellPolicy)
getCell
in interface
Row
(接口 Row 中的 getCell)
java.lang.IllegalArgumentException
- if cellnum < 0 or the specified MissingCellPolicy is invalid
(java.lang.IllegalArgumentException - 如果 cellnum < 0 或指定的 MissingCellPolicy 无效)
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++) { XSSFCell 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 short getHeight()
XSSFSheet.getDefaultRowHeightInPoints()
(获取以缇为单位的行高(1/20 点)。如果未设置高度,则返回默认工作表值,参见 XSSFSheet.getDefaultRowHeightInPoints())
public float getHeightInPoints()
XSSFSheet.getDefaultRowHeightInPoints()
(返回以磅为单位测量的行高。如果未设置高度,则返回默认工作表值,请参阅 XSSFSheet.getDefaultRowHeightInPoints())
getHeightInPoints
in interface
Row
(接口 Row 中的 getHeightInPoints)
XSSFSheet.getDefaultRowHeightInPoints()
public void setHeight(short height)
public void setHeightInPoints(float height)
setHeightInPoints
in interface
Row
(接口 Row 中的 setHeightInPoints)
height
- the height in points.
-1
resets to the default height
(height - 以磅为单位的高度。 -1 重置为默认高度)
public int getPhysicalNumberOfCells()
getPhysicalNumberOfCells
in interface
Row
(接口 Row 中的 getPhysicalNumberOfCells)
public int getRowNum()
public void setRowNum(int rowIndex)
public boolean getZeroHeight()
getZeroHeight
in interface
Row
(接口 Row 中的 getZeroHeight)
public void setZeroHeight(boolean height)
setZeroHeight
in interface
Row
(接口 Row 中的 setZeroHeight)
height
- height is zero or not.
(height - 高度是否为零。)
public boolean isFormatted()
getRowStyle()
(此行是否已格式化?大多数不是,但有些行确实具有整行样式。对于那些这样做的人,您可以从 getRowStyle() 获取格式)
isFormatted
in interface
Row
(isFormatted 在接口 Row 中)
public XSSFCellStyle getRowStyle()
isFormatted()
to check first.
(返回整行单元格样式。大多数行不会有其中之一,因此将返回 null。首先调用 isFormatted() 进行检查。)
getRowStyle
in interface
Row
(接口 Row 中的 getRowStyle)
public void setRowStyle(CellStyle style)
setRowStyle
in interface
Row
(接口 Row 中的 setRowStyle)
public void removeCell(Cell cell)
removeCell
in interface
Row
(接口 Row 中的 removeCell)
cell
- the cell to remove
(cell - 要删除的单元格)
@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow getCTRow()
protected void onDocumentWrite()
()
public java.lang.String toString()
toString
in class
java.lang.Object
protected void shift(int n)
n
- the number of rows to move
(n - 要移动的行数)
@Beta public void copyRowFrom(Row srcRow, CellCopyPolicy policy)
srcRow
- the rows to copy from
(srcRow - 要从中复制的行)
policy
- the policy to determine what gets copied
(policy - 确定复制内容的策略)
public int getOutlineLevel()
Row
getOutlineLevel
in interface
Row
(接口 Row 中的 getOutlineLevel)
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.