| Method from org.apache.cocoon.poi.hssf.usermodel.HSSFRow Detail: |
public HSSFCell createCell(short column,
int type) {
HSSFCell cell = new HSSFCell(book, sheet, getRowNum(), column, type);
addCell(cell, true);
sheet.addValueRecord(getRowNum(), cell.getCellValueRecord());
return cell;
}
Use this to create new cells within the row and return it. |
protected HSSFCell createCellFromRecord(CellValueRecordInterface cell) {
HSSFCell hcell = new HSSFCell(book, sheet, getRowNum(), cell);
addCell(hcell, false);
// sheet.addValueRecord(getRowNum(),cell.getCellValueRecord());
return hcell;
}
create a high level HSSFCell object from an existing low level record. Should
only be called from HSSFSheet or HSSFRow itself. |
public HSSFCell getCell(short cellnum) {
for (int k = 0; k < cells.size(); k++)
{
HSSFCell cell = ( HSSFCell ) cells.get(k);
if (cell.getCellNum() == cellnum)
{
return cell;
}
}
return null;
}
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. |
public List getCells() {
// shallow copy, modifying cells changes things
// modifying the array changes nothing!
return ( ArrayList ) cells.clone();
}
gets a list of cells in the row. |
public short getFirstCellNum() {
return firstcell;
}
get the number of the first cell contained in this row. |
public short getHeight() {
return row.getHeight();
}
get the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point) |
public float getHeightInPoints() {
return (row.getHeight() / 20);
}
get the row's height or ff (-1) for undefined/default-height in points (20*getHeight()) |
public short getLastCellNum() {
// if (cells.size() == 0) return -1;
// return ((HSSFCell)cells.get(cells.size()-1)).getCellNum();
return lastcell;
}
get the number of the last cell contained in this row. |
public HSSFCell getPhysicalCellAt(int num) {
return ( HSSFCell ) cells.get(num);
}
gets the phsyically defined cell at location (num) NOT its column number.
That is to say if only columns 0,4,5 have values then index 2 would equal cell with a column number of 4.
(though the order is not assured) |
public int getPhysicalNumberOfCells() {
if (cells == null)
{
return 0; // shouldn't be possible but it is due to missing API support for BLANK/MULBLANK
}
return cells.size();
}
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. |
public short getRowNum() {
return rowNum;
}
get row number this row represents |
protected RowRecord getRowRecord() {
return row;
}
get the lowlevel RowRecord represented by this object - should only be called
by other parts of the high level API |
public void removeCell(HSSFCell cell) {
CellValueRecordInterface cval = cell.getCellValueRecord();
sheet.removeValueRecord(getRowNum(), cval);
for (int k = 0; k < cells.size(); k++)
{
HSSFCell hcell = ( HSSFCell ) cells.get(k);
if (hcell.getCellNum() == cell.getCellNum())
{
cells.remove(k);
}
}
if ((cell.getCellNum() == getLastCellNum())
|| (cell.getCellNum() == getFirstCellNum()))
{
lastcell = -1;
firstcell = -1;
for (int k = 0; k < cells.size(); k++)
{
HSSFCell hcell = ( HSSFCell ) cells.get(k);
if (hcell.getCellNum() > lastcell)
{
lastcell = hcell.getCellNum();
}
if ((cell.getCellNum() < firstcell) || (firstcell == -1))
{
firstcell = hcell.getCellNum();
}
}
}
row.setFirstCol(firstcell);
row.setLastCol(lastcell);
}
remove the HSSFCell from this row. |
public void setHeight(short height) {
// row.setOptionFlags(
row.setBadFontHeight(true);
row.setHeight(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. |
public void setHeightInPoints(float height) {
// row.setOptionFlags(
row.setBadFontHeight(true);
row.setHeight(( short ) (height * 20));
}
set the row's height in points. |
public void setRowNum(short rowNum) {
this.rowNum = rowNum;
row.setRowNumber(rowNum);
}
set the row number of this row. |