|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.xssf.usermodel.XSSFRow
public class XSSFRow
High level representation of a row of a spreadsheet.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.Row |
---|
org.apache.poi.ss.usermodel.Row.MissingCellPolicy |
Field Summary |
---|
Fields inherited from interface org.apache.poi.ss.usermodel.Row |
---|
CREATE_NULL_AS_BLANK, RETURN_BLANK_AS_NULL, RETURN_NULL_AND_BLANK |
Method Summary | |
---|---|
java.util.Iterator |
cellIterator()
Cell iterator over the physically defined cells: |
int |
compareTo(java.lang.Object irow)
Compares two XSSFRow objects. |
org.apache.poi.ss.usermodel.Cell |
createCell(int columnIndex)
Use this to create new cells within the row and return it. |
org.apache.poi.ss.usermodel.Cell |
createCell(int columnIndex,
int type)
Use this to create new cells within the row and return it. |
org.apache.poi.ss.usermodel.Cell |
getCell(int cellnum)
Returns the cell at the given (0 based) index, with the Row.MissingCellPolicy from the parent Workbook. |
org.apache.poi.ss.usermodel.Cell |
getCell(int cellnum,
org.apache.poi.ss.usermodel.Row.MissingCellPolicy policy)
Returns the cell at the given (0 based) index, with the specified Row.MissingCellPolicy |
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow |
getCTRow()
Returns the underlying CTRow xml bean containing all cell definitions in this row |
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. |
short |
getLastCellNum()
Gets the index of the last cell contained in this row PLUS ONE. |
int |
getPhysicalNumberOfCells()
Gets the number of defined cells (NOT number of cells in the actual row!). |
int |
getRowNum()
Get row number this row represents |
org.apache.poi.ss.usermodel.Sheet |
getSheet()
Returns the XSSFSheet this row belongs to |
boolean |
getZeroHeight()
Get whether or not to display this row with 0 height |
java.util.Iterator |
iterator()
Alias for cellIterator() to allow foreach loops:
|
void |
removeCell(org.apache.poi.ss.usermodel.Cell cell)
Remove the Cell from this row. |
void |
setHeight(short height)
Set the height in "twips" or 1/20th of a point. |
void |
setHeightInPoints(float height)
Set the row's height in points. |
void |
setRowNum(int rowIndex)
Set the row number of this row. |
void |
setZeroHeight(boolean height)
Set whether or not to display this row with 0 height |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public org.apache.poi.ss.usermodel.Sheet getSheet()
getSheet
in interface org.apache.poi.ss.usermodel.Row
public java.util.Iterator cellIterator()
for (Iterator it = row.cellIterator(); it.hasNext(); ) { Cell cell = it.next(); ... }
cellIterator
in interface org.apache.poi.ss.usermodel.Row
public java.util.Iterator iterator()
cellIterator()
to allow foreach loops:
for(Cell cell : row){ ... }
iterator
in interface poi.support.Iterable
public int compareTo(java.lang.Object irow)
XSSFRow
objects. Two rows are equal if they belong to the same worksheet and
their row indexes are equal.
compareTo
in interface java.lang.Comparable
row
- the XSSFRow
to be compared.
0
if the row number of this XSSFRow
is
equal to the row number of the argument XSSFRow
; a value less than
0
if the row number of this this XSSFRow
is numerically less
than the row number of the argument XSSFRow
; and a value greater
than 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 worksheetpublic org.apache.poi.ss.usermodel.Cell createCell(int columnIndex)
The cell that is returned is a Cell.CELL_TYPE_BLANK
. The type can be changed
either through calling setCellValue
or setCellType
.
createCell
in interface org.apache.poi.ss.usermodel.Row
columnIndex
- - the column number this cell represents
java.lang.IllegalArgumentException
- if columnIndex < 0 or greater than 16384,
the maximum number of columns supported by the SpreadsheetML format (.xlsx)public org.apache.poi.ss.usermodel.Cell createCell(int columnIndex, int type)
createCell
in interface org.apache.poi.ss.usermodel.Row
columnIndex
- - the column number this cell representstype
- - the cell's data 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)Cell.CELL_TYPE_BLANK
,
Cell.CELL_TYPE_BOOLEAN
,
Cell.CELL_TYPE_ERROR
,
Cell.CELL_TYPE_FORMULA
,
Cell.CELL_TYPE_NUMERIC
,
Cell.CELL_TYPE_STRING
public org.apache.poi.ss.usermodel.Cell getCell(int cellnum)
Row.MissingCellPolicy
from the parent Workbook.
getCell
in interface org.apache.poi.ss.usermodel.Row
public org.apache.poi.ss.usermodel.Cell getCell(int cellnum, org.apache.poi.ss.usermodel.Row.MissingCellPolicy policy)
Row.MissingCellPolicy
getCell
in interface org.apache.poi.ss.usermodel.Row
java.lang.IllegalArgumentException
- if cellnum < 0 or the specified MissingCellPolicy is invalidRow.RETURN_NULL_AND_BLANK
,
Row.RETURN_BLANK_AS_NULL
,
Row.CREATE_NULL_AS_BLANK
public short getFirstCellNum()
getFirstCellNum
in interface org.apache.poi.ss.usermodel.Row
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 }
getLastCellNum
in interface org.apache.poi.ss.usermodel.Row
public short getHeight()
XSSFSheet.getDefaultRowHeightInPoints()
getHeight
in interface org.apache.poi.ss.usermodel.Row
public float getHeightInPoints()
XSSFSheet.getDefaultRowHeightInPoints()
getHeightInPoints
in interface org.apache.poi.ss.usermodel.Row
XSSFSheet.getDefaultRowHeightInPoints()
public void setHeight(short height)
setHeight
in interface org.apache.poi.ss.usermodel.Row
height
- the height in "twips" or 1/20th of a point. -1
resets to the default heightpublic void setHeightInPoints(float height)
setHeightInPoints
in interface org.apache.poi.ss.usermodel.Row
height
- the height in points. -1
resets to the default heightpublic int getPhysicalNumberOfCells()
getPhysicalNumberOfCells
in interface org.apache.poi.ss.usermodel.Row
public int getRowNum()
getRowNum
in interface org.apache.poi.ss.usermodel.Row
public void setRowNum(int rowIndex)
setRowNum
in interface org.apache.poi.ss.usermodel.Row
rowIndex
- the row number (0-based)
java.lang.IllegalArgumentException
- if rowNum < 0 or greater than 1048575public boolean getZeroHeight()
getZeroHeight
in interface org.apache.poi.ss.usermodel.Row
public void setZeroHeight(boolean height)
setZeroHeight
in interface org.apache.poi.ss.usermodel.Row
height
- height is zero or not.public void removeCell(org.apache.poi.ss.usermodel.Cell cell)
removeCell
in interface org.apache.poi.ss.usermodel.Row
cell
- the cell to removepublic org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow getCTRow()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |