Modifier and Type | Class and Description |
---|---|
class |
SXSSFRow.CellIterator
returns all cells including empty cells (
null values are returned
for empty cells). |
class |
SXSSFRow.FilledCellIterator
Create an iterator over the cells from [0, getLastCellNum()).
|
Row.MissingCellPolicy
Constructor and Description |
---|
SXSSFRow(SXSSFSheet sheet) |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<Cell> |
allCellsIterator() |
java.util.Iterator<Cell> |
cellIterator() |
int |
compareTo(SXSSFRow other)
Compares two
SXSSFRow objects. |
SXSSFCell |
createCell(int column)
Use this to create new cells within the row and return it.
|
SXSSFCell |
createCell(int column,
CellType type)
Use this to create new cells within the row and return it.
|
boolean |
equals(java.lang.Object obj) |
SXSSFCell |
getCell(int cellnum)
Get the cell representing a given column (logical cell) 0-based.
|
SXSSFCell |
getCell(int cellnum,
Row.MissingCellPolicy policy)
Returns the cell at the given (0 based) index, with the specified
Row.MissingCellPolicy |
java.lang.Boolean |
getCollapsed() |
short |
getFirstCellNum()
Get the number of the first cell contained in this row.
|
short |
getHeight()
Get the row's height measured in twips (1/20th of a point).
|
float |
getHeightInPoints()
Returns row height measured in point size.
|
java.lang.Boolean |
getHidden()
get row hidden state: Hidden (true), Unhidden (false), Undefined (null)
|
short |
getLastCellNum()
Gets the index of the last cell contained in this row 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
|
CellStyle |
getRowStyle()
Returns the whole-row cell style.
|
SXSSFSheet |
getSheet()
Returns the Sheet this row belongs to
|
boolean |
getZeroHeight()
Get whether or not to display this row with 0 height
|
boolean |
hasCustomHeight() |
int |
hashCode() |
boolean |
isFormatted()
Is this row formatted? Most aren't, but some rows
do have whole-row styles.
|
java.util.Iterator<Cell> |
iterator() |
void |
removeCell(Cell cell)
Remove the Cell from this row.
|
void |
setCollapsed(java.lang.Boolean collapsed) |
void |
setHeight(short height)
Set the row's height or set to ff (-1) for undefined/default-height.
|
void |
setHeightInPoints(float height)
Set the row's height in points.
|
void |
setHidden(java.lang.Boolean hidden)
set row hidden state: Hidden (true), Unhidden (false), Undefined (null)
|
void |
setRowNum(int rowNum)
Set the row number of this row.
|
void |
setRowStyle(CellStyle 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
|
void |
shiftCellsLeft(int firstShiftColumnIndex,
int lastShiftColumnIndex,
int step) |
void |
shiftCellsRight(int firstShiftColumnIndex,
int lastShiftColumnIndex,
int step) |
public SXSSFRow(SXSSFSheet sheet)
public java.util.Iterator<Cell> allCellsIterator()
public boolean hasCustomHeight()
public int getOutlineLevel()
Row
getOutlineLevel
in interface Row
public java.lang.Boolean getHidden()
public void setHidden(java.lang.Boolean hidden)
hidden
- row hidden statepublic java.lang.Boolean getCollapsed()
public void setCollapsed(java.lang.Boolean collapsed)
public java.util.Iterator<Cell> iterator()
iterator
in interface java.lang.Iterable<Cell>
public SXSSFCell 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
column
- - the column number this cell representsjava.lang.IllegalArgumentException
- if columnIndex < 0 or greater than the maximum number of supported columns
(255 for *.xls, 1048576 for *.xlsx)public SXSSFCell createCell(int column, CellType type)
The cell that is returned is a CellType.BLANK
. The type can be changed
either through calling setCellValue or setCellType.
createCell
in interface Row
column
- - the column number this cell representstype
- - the cell's data typejava.lang.IllegalArgumentException
- if columnIndex < 0 or greater than a maximum number of supported columns
(255 for *.xls, 1048576 for *.xlsx)public void removeCell(Cell cell)
removeCell
in interface Row
cell
- the cell to removepublic void setRowNum(int rowNum)
public int getRowNum()
public SXSSFCell getCell(int cellnum)
getCell
in interface Row
cellnum
- 0 based column numberjava.lang.RuntimeException
- if cellnum is out of boundsgetCell(int, org.apache.poi.ss.usermodel.Row.MissingCellPolicy)
public SXSSFCell getCell(int cellnum, Row.MissingCellPolicy policy)
Row.MissingCellPolicy
public short getFirstCellNum()
getFirstCellNum
in interface Row
public short getLastCellNum()
short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for(short colIx=minColIx; colIx<maxColIx; colIx++) { Cell cell = row.getCell(colIx); if(cell == null) { continue; } //... do something with cell }
getLastCellNum
in interface Row
public int getPhysicalNumberOfCells()
getPhysicalNumberOfCells
in interface Row
public void setHeight(short height)
public void setZeroHeight(boolean zHeight)
setZeroHeight
in interface Row
zHeight
- height is zero or not.public boolean getZeroHeight()
getZeroHeight
in interface Row
public void setHeightInPoints(float height)
setHeightInPoints
in interface Row
height
- the height in points. -1
resets to the default heightpublic short getHeight()
Sheet.getDefaultRowHeightInPoints()
public float getHeightInPoints()
Sheet.getDefaultRowHeightInPoints()
getHeightInPoints
in interface Row
Sheet.getDefaultRowHeightInPoints()
public boolean isFormatted()
getRowStyle()
isFormatted
in interface Row
public CellStyle getRowStyle()
isFormatted()
to check first.getRowStyle
in interface Row
public void setRowStyle(CellStyle style)
null
.setRowStyle
in interface Row
public java.util.Iterator<Cell> cellIterator()
cellIterator
in interface Row
public SXSSFSheet getSheet()
public int compareTo(SXSSFRow other)
SXSSFRow
objects. Two rows are equal if they belong to the same worksheet and
their row indexes are equal.compareTo
in interface java.lang.Comparable<SXSSFRow>
other
- the SXSSFRow
to be compared.0
if the row number of this SXSSFRow
is
equal to the row number of the argument SXSSFRow
0
if the row number of this this SXSSFRow
is
numerically less than the row number of the argument SXSSFRow
0
if the row number of this this SXSSFRow
is
numerically greater than the row number of the argument SXSSFRow
java.lang.IllegalArgumentException
- if the argument row belongs to a different worksheetpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
@NotImplemented public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
shiftCellsRight
in interface Row
@NotImplemented public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step)
shiftCellsLeft
in interface Row
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.