Methods Summary |
---|
private void | addCell(org.apache.poi.hssf.usermodel.HSSFCell cell)used internally to add a cell.
short column=cell.getCellNum();
if (row.getFirstCol() == -1)
{
row.setFirstCol(column);
}
if (row.getLastCol() == -1)
{
row.setLastCol(column);
}
if(column>=cells.length)
{
HSSFCell[] oldCells=cells;
int newSize=oldCells.length*2;
if(newSize<column+1) newSize=column+1;
cells=new HSSFCell[newSize];
System.arraycopy(oldCells,0,cells,0,oldCells.length);
}
cells[column]=cell;
if (column < row.getFirstCol())
{
row.setFirstCol(column);
}
if (column > row.getLastCol())
{
row.setLastCol(column);
}
|
public java.util.Iterator | cellIterator()
return new CellIterator();
|
public int | compareTo(java.lang.Object obj)
HSSFRow loc = (HSSFRow) obj;
if (this.getRowNum() == loc.getRowNum())
{
return 0;
}
if (this.getRowNum() < loc.getRowNum())
{
return -1;
}
if (this.getRowNum() > loc.getRowNum())
{
return 1;
}
return -1;
|
public org.apache.poi.hssf.usermodel.HSSFCell | createCell(short column)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 .
return this.createCell(column,HSSFCell.CELL_TYPE_BLANK);
|
public org.apache.poi.hssf.usermodel.HSSFCell | createCell(short column, int type)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.
HSSFCell cell = new HSSFCell(book, sheet, getRowNum(), column, type);
addCell(cell);
sheet.addValueRecord(getRowNum(), cell.getCellValueRecord());
return cell;
|
protected org.apache.poi.hssf.usermodel.HSSFCell | createCellFromRecord(org.apache.poi.hssf.record.CellValueRecordInterface cell)create a high level HSSFCell object from an existing low level record. Should
only be called from HSSFSheet or HSSFRow itself.
HSSFCell hcell = new HSSFCell(book, sheet, getRowNum(), cell);
addCell(hcell);
// sheet.addValueRecord(getRowNum(),cell.getCellValueRecord());
return hcell;
|
public boolean | equals(java.lang.Object obj)
if (!(obj instanceof HSSFRow))
{
return false;
}
HSSFRow loc = (HSSFRow) obj;
if (this.getRowNum() == loc.getRowNum())
{
return true;
}
return false;
|
private short | findFirstCell(short firstcell)used internally to refresh the "first cell" when the first cell is removed.
short cellnum = (short) (firstcell + 1);
HSSFCell r = getCell(cellnum);
while (r == null && cellnum <= getLastCellNum())
{
r = getCell(++cellnum);
}
if (cellnum > getLastCellNum())
return -1;
return cellnum;
|
private short | findLastCell(short lastcell)used internally to refresh the "last cell" when the last cell is removed.
short cellnum = (short) (lastcell - 1);
HSSFCell r = getCell(cellnum);
while (r == null && cellnum >= 0)
{
r = getCell(--cellnum);
}
return cellnum;
|
public org.apache.poi.hssf.usermodel.HSSFCell | getCell(short cellnum)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.
if(cellnum<0||cellnum>=cells.length) return null;
return cells[cellnum];
|
public short | getFirstCellNum()get the number of the first cell contained in this row.
if (getPhysicalNumberOfCells() == 0)
return -1;
else
return row.getFirstCol();
|
public short | getHeight()get the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point)
return row.getHeight();
|
public float | getHeightInPoints()get the row's height or ff (-1) for undefined/default-height in points (20*getHeight())
return (row.getHeight() / 20);
|
public short | getLastCellNum()gets the number of the last cell contained in this row PLUS ONE.
if (getPhysicalNumberOfCells() == 0)
return -1;
else
return row.getLastCol();
|
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.
int count=0;
for(int i=0;i<cells.length;i++)
{
if(cells[i]!=null) count++;
}
return count;
|
public int | getRowNum()get row number this row represents
return rowNum;
|
protected org.apache.poi.hssf.record.RowRecord | getRowRecord()get the lowlevel RowRecord represented by this object - should only be called
by other parts of the high level API
return row;
|
public boolean | getZeroHeight()get whether or not to display this row with 0 height
return row.getZeroHeight();
|
public void | removeCell(org.apache.poi.hssf.usermodel.HSSFCell cell)remove the HSSFCell from this row.
CellValueRecordInterface cval = cell.getCellValueRecord();
sheet.removeValueRecord(getRowNum(), cval);
short column=cell.getCellNum();
if(cell!=null && column<cells.length)
{
cells[column]=null;
}
if (cell.getCellNum() == row.getLastCol())
{
row.setLastCol(findLastCell(row.getLastCol()));
}
if (cell.getCellNum() == row.getFirstCol())
{
row.setFirstCol(findFirstCell(row.getFirstCol()));
}
|
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.
// row.setOptionFlags(
row.setBadFontHeight(true);
row.setHeight(height);
|
public void | setHeightInPoints(float height)set the row's height in points.
// row.setOptionFlags(
row.setBadFontHeight(true);
row.setHeight((short) (height * 20));
|
public void | setRowNum(int rowNum)set the row number of this row.
if ((rowNum < 0) || (rowNum > RowRecord.MAX_ROW_NUMBER))
throw new IndexOutOfBoundsException("Row number must be between 0 and "+RowRecord.MAX_ROW_NUMBER+", was <"+rowNum+">");
this.rowNum = rowNum;
if (row != null)
{
row.setRowNumber(rowNum); // used only for KEY comparison (HSSFRow)
}
|
public void | setZeroHeight(boolean zHeight)set whether or not to display this row with 0 height
row.setZeroHeight(zHeight);
|