com.jrefinery.workbook
Class Cell

java.lang.Object
  |
  +--com.jrefinery.workbook.Cell
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
DateCell, FormulaCell, LabelCell, ValueCell

public class Cell
extends java.lang.Object
implements java.lang.Comparable

Represents one cell in a worksheet.


Field Summary
protected  int column
          The column number (0 to Worksheet.MAX_COLUMNS-1).
protected  java.lang.String content
          The cell contents.
static int DATE
          Constant for date cell.
static int EXPRESSION
          Constant for formula cell.
static int LABEL
          Constant for label cell.
protected  int row
          The row number (0 to Worksheet.MAX_ROWS-1).
static int VALUE
          Constant for value cell.
protected  java.lang.String valueFormat
          The value format (if required).
protected  int valueType
          The type of data in the cell.
 
Constructor Summary
Cell(int column, int row, int valueType, java.lang.String content)
          Standard constructor.
 
Method Summary
 int compareTo(java.lang.Object other)
          Implements the Comparable interface so that cells can easily be sorted.
 int getSerialNumber()
          Returns an integer that increases across columns and down rows.
 void writeCell(java.io.PrintStream out, java.lang.String indent)
          Write the cell element.
protected  void writeContent(java.io.PrintStream out, java.lang.String indent)
          Write the cell contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPRESSION

public static final int EXPRESSION
Constant for formula cell.

DATE

public static final int DATE
Constant for date cell.

VALUE

public static final int VALUE
Constant for value cell.

LABEL

public static final int LABEL
Constant for label cell.

column

protected int column
The column number (0 to Worksheet.MAX_COLUMNS-1).

row

protected int row
The row number (0 to Worksheet.MAX_ROWS-1).

valueType

protected int valueType
The type of data in the cell. So far I know of: 30=date, 40=value, 60=label; For expressions, no value type is shown, so assume 0 for now.

content

protected java.lang.String content
The cell contents.

valueFormat

protected java.lang.String valueFormat
The value format (if required).
Constructor Detail

Cell

public Cell(int column,
            int row,
            int valueType,
            java.lang.String content)
Standard constructor.
Parameters:
column - The column.
row - The row.
valueType - The cell type.
content - The cell contents.
Method Detail

compareTo

public int compareTo(java.lang.Object other)
Implements the Comparable interface so that cells can easily be sorted.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - The object being compared to.

getSerialNumber

public int getSerialNumber()
Returns an integer that increases across columns and down rows.

writeCell

public void writeCell(java.io.PrintStream out,
                      java.lang.String indent)
Write the cell element. So far, it will work for labels, numbers and expressions. Of course, the intention is to ensure that it works for all types.
Parameters:
out - The output stream.
indent - The indentation.

writeContent

protected void writeContent(java.io.PrintStream out,
                            java.lang.String indent)
Write the cell contents.
Parameters:
out - The output stream.
indent - The indentation.