public final class HSSFRow extends java.lang.Object implements Row
Row.MissingCellPolicy
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_CAPACITY |
CREATE_NULL_AS_BLANK, RETURN_BLANK_AS_NULL, RETURN_NULL_AND_BLANK
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<Cell> |
cellIterator() |
int |
compareTo(java.lang.Object obj) |
HSSFCell |
createCell(int column)
Use this to create new cells within the row and return it.
|
HSSFCell |
createCell(int columnIndex,
int type)
Use this to create new cells within the row and return it.
|
HSSFCell |
createCell(short columnIndex)
Deprecated.
(Aug 2008) use
createCell(int) |
HSSFCell |
createCell(short columnIndex,
int type)
Deprecated.
(Aug 2008) use
createCell(int, int) |
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.
|
HSSFCell |
getCell(short cellnum)
Deprecated.
(Aug 2008) use
getCell(int) |
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.
|
protected 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
|
boolean |
isCustomHeight() |
boolean |
isFormatted()
Is this row formatted?
|
java.util.Iterator |
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 |
setCustomHeight(boolean b) |
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
|
void |
shiftCells(int startCol,
int endCol,
int n,
boolean clearRest)
Shifts cells between startColumn and endColumn n number of columns.
|
public static final int INITIAL_CAPACITY
public HSSFCell createCell(short columnIndex)
createCell(int)
public HSSFCell createCell(short columnIndex, int type)
createCell(int, int)
public HSSFCell createCell(int column)
The cell that is returned is a CELL_TYPE_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 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 is a CELL_TYPE_BLANK. The type can be changed either through calling setCellValue or setCellType.
createCell
in interface Row
columnIndex
- - the column number this cell representsjava.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 Row
cell
- to removeprotected void removeAllCells()
public void setRowNum(int rowIndex)
public int getRowNum()
public HSSFSheet getSheet()
protected int getOutlineLevel()
public void moveCell(HSSFCell cell, short newColumn)
cell
- The cell to movenewColumn
- The new column number (0 based)public HSSFCell getCell(short cellnum)
getCell(int)
public HSSFCell getCell(int cellnum)
Row.MissingCellPolicy
on the base workbook.getCell
in interface Row
cellnum
- 0 based column numberRow.getCell(int, org.zkoss.poi.ss.usermodel.Row.MissingCellPolicy)
public HSSFCell getCell(int cellnum, Row.MissingCellPolicy policy)
getCell
in interface Row
cellnum
- 0 based column numberpolicy
- Policy on blank / missing cellsRow.RETURN_NULL_AND_BLANK
,
Row.RETURN_BLANK_AS_NULL
,
Row.CREATE_NULL_AS_BLANK
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++) { HSSFCell 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
- row height in points, -1
means to use the default heightpublic short getHeight()
public float getHeightInPoints()
getHeightInPoints
in interface Row
Sheet.getDefaultRowHeightInPoints()
protected RowRecord getRowRecord()
public boolean isFormatted()
getRowStyle()
isFormatted
in interface Row
public HSSFCellStyle getRowStyle()
isFormatted()
to check first.getRowStyle
in interface Row
public void setRowStyle(HSSFCellStyle style)
public void setRowStyle(CellStyle style)
setRowStyle
in interface Row
public java.util.Iterator<Cell> cellIterator()
cellIterator
in interface Row
Row.MissingCellPolicy
has no effect.public java.util.Iterator iterator()
cellIterator()
to allow
foreach loopsiterator
in interface java.lang.Iterable<Cell>
public int compareTo(java.lang.Object obj)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void shiftCells(int startCol, int endCol, int n, boolean clearRest)
startCol
- the column to start shiftingendCol
- the column to end shiftingn
- the number of columns to shiftclearRest
- whether clear the rest cells after the shifted endColpublic boolean isCustomHeight()
isCustomHeight
in interface Row
public void setCustomHeight(boolean b)
setCustomHeight
in interface Row
Copyright © 2005-2010 Potix Corporation. All Rights Reserved.