Save This Page
Home » cocoon-2.1.11-src » org.apache.cocoon.poi » hssf » usermodel » [javadoc | source]
org.apache.cocoon.poi.hssf.usermodel
public class: HSSFCell [javadoc | source]
java.lang.Object
   org.apache.cocoon.poi.hssf.usermodel.HSSFCell
High level representation of a cell in a row of a spreadsheet. Cells can be numeric, formula-based or string-based (text). The cell type specifies this. String cells cannot conatin numbers and numeric cells cannot contain strings (at least according to our model). Client apps should do the conversions themselves. Formula cells are treated like string cells, simply containing a formula string. They'll be rendered differently. Cells should have their number (0 based) before being added to a row. Only cells that have values should be added. NOTE: the alpha won't be implementing formulas
Field Summary
public static final  int CELL_TYPE_NUMERIC    Numeric Cell type (0) 
public static final  int CELL_TYPE_STRING    String Cell type (1) 
public static final  int CELL_TYPE_FORMULA    Formula Cell type (2) 
public static final  int CELL_TYPE_BLANK    Blank Cell type (3) 
public static final  short ENCODING_COMPRESSED_UNICODE     
public static final  short ENCODING_UTF_16     
Constructor:
 protected HSSFCell(Workbook book,
    Sheet sheet,
    short row,
    CellValueRecordInterface cval) 
    Creates an HSSFCell from a CellValueRecordInterface. HSSFSheet uses this when reading in cells from an existing sheet.
    Parameters:
    book - - Workbook record of the workbook containing this cell
    sheet - - Sheet record of the sheet containing this cell
    cval - - the Cell Value Record we wish to represent
 protected HSSFCell(Workbook book,
    Sheet sheet,
    short row,
    short col,
    int type) 
    Creates new Cell - Should only be called by HSSFRow. This creates a cell from scratch.
    Parameters:
    book - - Workbook record of the workbook containing this cell
    sheet - - Sheet record of the sheet containing this cell
    row - - the row of this cell
    col - - the column for this cell
    type - - CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK - Type of cell
    Also see:
    org.apache.cocoon.poi.hssf.usermodel.HSSFRow#createCell(short,int)
Method from org.apache.cocoon.poi.hssf.usermodel.HSSFCell Summary:
getCellNum,   getCellStyle,   getCellType,   getCellValueRecord,   getEncoding,   getNumericCellValue,   getStringCellValue,   setCellNum,   setCellStyle,   setCellType,   setCellValue,   setCellValue,   setEncoding
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cocoon.poi.hssf.usermodel.HSSFCell Detail:
 public short getCellNum() 
    get the cell's number within the row
 public HSSFCellStyle getCellStyle() 
    get the style for the cell. This is a reference to a cell style contained in the workbook object.
 public int getCellType() 
    get the cells type (numeric, formula or string)
 protected CellValueRecordInterface getCellValueRecord() 
    Should only be used by HSSFSheet and friends. Returns the low level CellValueRecordInterface record
 public short getEncoding() 
    used for internationalization, currently 0 for compressed unicode or 1 for 16-bit
 public double getNumericCellValue() 
    get the value of the cell as a number. For strings we throw an exception. For blank cells we return a 0.
 public String getStringCellValue() 
    get the value of the cell as a string - for numeric cells we throw an exception. For blank cells we return an empty string.
 public  void setCellNum(short num) 
    set the cell's number within the row (0 based)
 public  void setCellStyle(HSSFCellStyle style) 
    set the style for the cell. The style should be an HSSFCellStyle created/retreived from the HSSFWorkbook.
 public  void setCellType(int cellType) 
    set the cells type (numeric, formula or string) -- DONT USE FORMULAS IN THIS RELEASE WE'LL THROW YOU A RUNTIME EXCEPTION IF YOU DO
 public  void setCellValue(double value) 
    set a numeric value for the cell
 public  void setCellValue(String value) 
    set a string value for the cell.
 public  void setEncoding(short encoding) 
    set the encoding to either 8 or 16 bit. (US/UK use 8-bit, rest of the western world use 16bit)