|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.hssf.usermodel.HSSFRow
public final class HSSFRow
High level representation of a row of a spreadsheet. Only rows that have cells should be added to a Sheet.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.Row |
|---|
Row.MissingCellPolicy |
| Field Summary | |
|---|---|
static int |
INITIAL_CAPACITY
|
| Method Summary | |
|---|---|
java.util.Iterator<Cell> |
cellIterator()
|
int |
compareTo(HSSFRow other)
Compares two HSSFRow objects. |
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. |
HSSFCell |
createCell(int columnIndex,
int type)
Deprecated. POI 3.15 beta 3 |
boolean |
equals(java.lang.Object obj)
|
HSSFCell |
getCell(int cellnum)
Get the hssfcell representing a given column (logical cell) 0-based. |
HSSFCell |
getCell(int cellnum,
Row.MissingCellPolicy policy)
Get the hssfcell representing a given column (logical cell) 0-based. |
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) |
float |
getHeightInPoints()
get the row's height or ff (-1) for undefined/default-height in points (20*getHeight()) |
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 |
protected RowRecord |
getRowRecord()
get the lowlevel RowRecord represented by this object - should only be called by other parts of the high level API |
HSSFCellStyle |
getRowStyle()
Returns the whole-row cell styles. |
HSSFSheet |
getSheet()
Returns the HSSFSheet this row belongs to |
boolean |
getZeroHeight()
get whether or not to display this row with 0 height |
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 |
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. |
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 |
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INITIAL_CAPACITY
| Method Detail |
|---|
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 Rowcolumn - - the column number this cell represents
java.lang.IllegalArgumentException - if columnIndex < 0 or greater than 255,
the maximum number of columns supported by the Excel binary format (.xls)
public HSSFCell createCell(int columnIndex,
int 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.
createCell in interface RowcolumnIndex - - the column number this cell representstype - - the cell's data type
java.lang.IllegalArgumentException - if columnIndex < 0 or greater than 255,
the maximum number of columns supported by the Excel binary format (.xls)CellType.BLANK,
CellType.BOOLEAN,
CellType.ERROR,
CellType.FORMULA,
CellType.NUMERIC,
CellType.STRING
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.
createCell in interface RowcolumnIndex - - the column number this cell representstype - - the cell's data type
java.lang.IllegalArgumentException - if columnIndex < 0 or greater than 255,
the maximum number of columns supported by the Excel binary format (.xls)public void removeCell(Cell cell)
removeCell in interface Rowcell - to removeprotected void removeAllCells()
public void setRowNum(int rowIndex)
setRowNum in interface RowrowIndex - the row number (0-based)
java.lang.IndexOutOfBoundsException - if the row number is not within the range 0-65535.public int getRowNum()
getRowNum in interface Rowpublic HSSFSheet getSheet()
getSheet in interface Rowpublic int getOutlineLevel()
getOutlineLevel in interface Row
public void moveCell(HSSFCell cell,
short newColumn)
cell - The cell to movenewColumn - The new column number (0 based)public HSSFCell getCell(int cellnum)
Row.MissingCellPolicy on the base workbook.
getCell in interface Rowcellnum - 0 based column number
Row.getCell(int, org.apache.poi.ss.usermodel.Row.MissingCellPolicy)
public HSSFCell getCell(int cellnum,
Row.MissingCellPolicy policy)
getCell in interface Rowcellnum - 0 based column numberpolicy - Policy on blank / missing cells
public short getFirstCellNum()
getFirstCellNum in interface Rowpublic 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
}
getLastCellNum in interface Rowpublic int getPhysicalNumberOfCells()
getPhysicalNumberOfCells in interface Rowpublic void setHeight(short height)
setHeight in interface Rowheight - rowheight or -1 for undefined (use sheet default)public void setZeroHeight(boolean zHeight)
setZeroHeight in interface RowzHeight - height is zero or not.public boolean getZeroHeight()
getZeroHeight in interface Rowpublic void setHeightInPoints(float height)
setHeightInPoints in interface Rowheight - row height in points, -1 means to use the default heightpublic short getHeight()
getHeight in interface Rowpublic float getHeightInPoints()
getHeightInPoints in interface RowSheet.getDefaultRowHeightInPoints()protected RowRecord getRowRecord()
public boolean isFormatted()
getRowStyle()
isFormatted in interface Rowpublic HSSFCellStyle getRowStyle()
isFormatted() to check first.
getRowStyle in interface Rowpublic void setRowStyle(HSSFCellStyle style)
public void setRowStyle(CellStyle style)
setRowStyle in interface Rowpublic java.util.Iterator<Cell> cellIterator()
cellIterator in interface RowRow.MissingCellPolicy has no effect.public java.util.Iterator<Cell> iterator()
cellIterator() to allow
foreach loops
iterator in interface java.lang.Iterable<Cell>public int compareTo(HSSFRow other)
HSSFRow objects. Two rows are equal if they belong to the same worksheet and
their row indexes are equal.
compareTo in interface java.lang.Comparable<HSSFRow>other - the HSSFRow to be compared.
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 worksheetpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||