Package loci.poi.hssf.usermodel
Class HSSFRow
java.lang.Object
loci.poi.hssf.usermodel.HSSFRow
- All Implemented Interfaces:
Comparable
High level representation of a row of a spreadsheet.
Only rows that have cells should be added to a Sheet.
- Version:
- 1.0-pre
- Author:
- Andrew C. Oliver (acoliver at apache dot org), Glen Stampoultzis (glens at apache.org)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcreateCell(short column) Use this to create new cells within the row and return it.createCell(short column, int type) Use this to create new cells within the row and return it.protected HSSFCellcreate a high level HSSFCell object from an existing low level record.booleangetCell(short cellnum) get the hssfcell representing a given column (logical cell) 0-based.shortget the number of the first cell contained in this row.shortget the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point)floatget the row's height or ff (-1) for undefined/default-height in points (20*getHeight())shortgets the number of the last cell contained in this row PLUS ONE.intgets the number of defined cells (NOT number of cells in the actual row!).intget row number this row representsprotected RowRecordget the lowlevel RowRecord represented by this object - should only be called by other parts of the high level APIbooleanget whether or not to display this row with 0 heightvoidremoveCell(HSSFCell cell) remove the HSSFCell from this row.voidsetHeight(short height) set the row's height or set to ff (-1) for undefined/default-height.voidsetHeightInPoints(float height) set the row's height in points.voidsetRowNum(int rowNum) set the row number of this row.voidsetZeroHeight(boolean zHeight) set whether or not to display this row with 0 height
-
Field Details
-
INITIAL_CAPACITY
public static final int INITIAL_CAPACITY- See Also:
-
-
Constructor Details
-
HSSFRow
protected HSSFRow() -
HSSFRow
Creates new HSSFRow from scratch. Only HSSFSheet should do this.- Parameters:
book- low-level Workbook object containing the sheet that contains this rowsheet- low-level Sheet object that contains this RowrowNum- the row number of this row (0 based)- See Also:
-
HSSFRow
Creates an HSSFRow from a low level RowRecord object. Only HSSFSheet should do this. HSSFSheet uses this when an existing file is read in.- Parameters:
book- low-level Workbook object containing the sheet that contains this rowsheet- low-level Sheet object that contains this Rowrecord- the low level api object this row should represent- See Also:
-
-
Method Details
-
createCell
Use this to create new cells within the row and return it.The cell that is returned is a CELL_TYPE_BLANK. The type can be changed either through calling
setCellValueorsetCellType.- Parameters:
column- - the column number this cell represents- Returns:
- HSSFCell a high level representation of the created cell.
-
createCell
Use this to create new cells within the row and return it.The cell that is returned is a CELL_TYPE_BLANK. The type can be changed either through calling setCellValue or setCellType.
- Parameters:
column- - the column number this cell represents- Returns:
- HSSFCell a high level representation of the created cell.
-
removeCell
remove the HSSFCell from this row.- Parameters:
cell- to remove
-
createCellFromRecord
create a high level HSSFCell object from an existing low level record. Should only be called from HSSFSheet or HSSFRow itself.- Parameters:
cell- low level cell to create the high level representation from- Returns:
- HSSFCell representing the low level record passed in
-
setRowNum
public void setRowNum(int rowNum) set the row number of this row.- Parameters:
rowNum- the row number (0-based)- Throws:
IndexOutOfBoundsException- if the row number is not within the range 0-65535.
-
getRowNum
public int getRowNum()get row number this row represents- Returns:
- the row number (0 based)
-
getCell
get the hssfcell representing a given column (logical cell) 0-based. If you ask for a cell that is not defined....you get a null.- Parameters:
cellnum- 0 based column number- Returns:
- HSSFCell representing that column or null if undefined.
-
getFirstCellNum
public short getFirstCellNum()get the number of the first cell contained in this row.- Returns:
- short representing the first logical cell in the row, or -1 if the row does not contain any cells.
-
getLastCellNum
public short getLastCellNum()gets the number of the last cell contained in this row PLUS ONE.- Returns:
- short representing the last logical cell in the row PLUS ONE, or -1 if the row does not contain any cells.
-
getPhysicalNumberOfCells
public int getPhysicalNumberOfCells()gets the number of defined cells (NOT number of cells in the actual row!). That is to say if only columns 0,4,5 have values then there would be 3.- Returns:
- int representing the number of defined cells in the row.
-
setHeight
public void setHeight(short height) set the row's height or set to ff (-1) for undefined/default-height. Set the height in "twips" or 1/20th of a point.- Parameters:
height- rowheight or 0xff for undefined (use sheet default)
-
setZeroHeight
public void setZeroHeight(boolean zHeight) set whether or not to display this row with 0 height- Parameters:
zHeight- height is zero or not.
-
getZeroHeight
public boolean getZeroHeight()get whether or not to display this row with 0 height- Returns:
- - zHeight height is zero or not.
-
setHeightInPoints
public void setHeightInPoints(float height) set the row's height in points.- Parameters:
height- row height in points
-
getHeight
public short getHeight()get the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point)- Returns:
- rowheight or 0xff for undefined (use sheet default)
-
getHeightInPoints
public float getHeightInPoints()get the row's height or ff (-1) for undefined/default-height in points (20*getHeight())- Returns:
- rowheight or 0xff for undefined (use sheet default)
-
getRowRecord
get the lowlevel RowRecord represented by this object - should only be called by other parts of the high level API- Returns:
- RowRecord this row represents
-
cellIterator
- Returns:
- cell iterator of the physically defined cells. Note element 4 may actually be row cell depending on how many are defined!
-
compareTo
- Specified by:
compareToin interfaceComparable
-
equals
-