All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.excelaccessor.ExcelCell
java.lang.Object
|
+----com.ibm.excelaccessor.ExcelCell
- public class ExcelCell
- extends Object
- implements PropertyChangeListener, Serializable
This bean represents a cell in an Excel Worksheet. This bean uses the
facilities provided by the ExcelWorkbook bean to access the cell.
The sheet name and the range name identify the cell. If the range
consists of more than one cell then this bean operates on the top-left
cell in the range. The
user of this bean needs to initialize (turn on) this bean before it
can be used for accessing the range properties. Once the bean has
been initialized, setting the properties of the range writes to the
file.
This bean is similar in functionality to the ExcelRange bean, except
that it operates on a single cell.
-
ExcelCell()
- Constructs an ExcelCell object with
properties autoCreateSheet and autoUnprotectSheet set to
false.
-
addExcelCellErrorListener(ExcelCellErrorListener)
- Adds the specified ExcelCellErrorListener to receive
ExcelCellError events from the ExcelCell bean.
-
addExcelCellListener(ExcelCellListener)
- Adds the specified ExcelCellListener to receive
ExcelCell events from the ExcelCell bean.
-
addExcelSheetListener(ExcelSheetListener)
- Adds the specified ExcelSheetListener to receive
ExcelSheet events from the ExcelRange bean.
-
addFetchArgumentsListener(FetchArgumentsListener)
- Adds the specified FetchArgumentsListener to receive
FetchArguments events from the ExcelRange bean.
-
addFetchPasswordListener(FetchPasswordListener)
- Adds the specified FetchPasswordListener to receive
FetchPassword events from the ExcelRange bean.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds the specified PropertyChangeListener to receive
PropertyChange events from the ExcelRange bean.
-
clear()
- Clears all the cell properties (value, formula,
format, text and noteText) for this Cell.
-
clearContents()
- Clears the cell contents (value and formula, if any)
for this Cell.
-
clearFormats()
- Clears all cell formatting information for
this cell, the value, noteText
and formula are retained.
-
clearNotes()
- Clears notetext for this cell,
the value, formula and format information are
retained.
-
createNamedCell(String)
- Assigns a name to the current cell.
-
getColumnHeaders()
- Returns a Vector of Strings, which represents the headers of the
columns of the range (as integers).
-
getEndCol()
- Returns the column number for the bottom right cell of
the range.
-
getEndRow()
- Returns the row number for the bottom right cell of
the range.
-
getFormat()
- Returns the Format property of the cell as a String.
-
getFormula()
- Returns the Formula property for the Cell as a String.
-
getNCols()
- Returns the number of columns present in the range.
-
getNoteText()
- Returns the noteText for the cell.
-
getNRows()
- Returns the number of rows present in the range.
-
getRangeName()
- Returns the name of the range if the
range has been selected using rangeName.
-
getRowHeaders()
- Returns a Vector of Strings, which represents the headers of the
rows of the range (as integers).
-
getStartCol()
- Returns the column number for the top left cell of
the range.
-
getStartRow()
- Returns the row number for the top left cell of
the range.
-
getText()
- Returns the Text property for the Range.
-
getValue()
- Returns the Value property for the Range.
-
getWorksheetName()
-
Returns the name of the worksheet.
-
hasArray()
- Method to check whether the cell is part of an array.
-
hasFormula()
- Method to check whether the cell contains
a formula.
-
initCell()
- A call to this method initializes the cell bean and
essentially turns it
on for further use.
-
insertWorksheet()
- Inserts a new worksheet in the workbook and renames it to
the worksheetName of this range.
-
isAutoCreateSheet()
- Returns the value of the autoCreateSheet property.
-
isAutoUnprotectSheet()
- Returns the value of the autoUnprotectSheet property.
-
isInitialized()
- Returns the status of the initialization of the cell bean.
-
propertyChange(PropertyChangeEvent)
- The listener method for property change events.
-
removeExcelCellErrorListener(ExcelCellErrorListener)
- Removes the specified ExcelCellErrorListener so that it no longer
receives ExcelCellErrorEvents from this bean.
-
removeExcelCellListener(ExcelCellListener)
- Removes the specified ExcelCellListener so that it no longer
receives ExcelCellEvents from this bean.
-
removeExcelSheetListener(ExcelSheetListener)
- Removes the specified ExcelSheetListener so that it no longer
receives ExcelSheetEvents from this bean.
-
removeFetchArgumentsListener(FetchArgumentsListener)
- Removes the specified FetchArgumentsListener so that it no longer
receives FetchArgumentsEvents from this bean.
-
removeFetchPasswordListener(FetchPasswordListener)
- Removes the specified FetchPasswordListener so that it no longer
receives FetchPasswordEvents from this bean.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes the specified PropertyChangeListener so that it no longer
receives PropertyChangeEvents from this bean.
-
removeWorksheet()
-
Removes a worksheet from the workbook.
-
setAutoCreateSheet(boolean)
- Sets the value of the autoCreateSheet property.
-
setAutoUnprotectSheet(boolean)
- Sets the value of the autoUnprotectSheet property.
-
setCellR1C1(int, int)
- This method can be used to identify a single cell as the range
to be accessed using the cell row and column numbers.
-
setFormat(String)
- Sets the format property of this cell.
-
setFormula(String)
- Sets the formula property of the cell.
-
setNoteText(String)
- Sets the noteText for the cell.
-
setRangeName(String)
- Sets the name of the Range to be accessed.
-
setRangeR1C1(int, int, int, int)
- This method can be used to identify the range to be accessed
using the positions of the top-left and bottom-right cells.
-
setValue(Object)
- Sets the value property of this cell.
-
setWorksheetName(String)
- Sets the name of the worksheet to be accessed.
-
setWorksheetProtectionPassword(String)
- Sets the worksheet protection password to be used
while unprotecting the worksheet.
-
setXlWorkbook(ExcelWorkbook)
- Sets the reference to the ExcelWorkbook bean that this cell bean
operates on.
-
unprotectWorksheet()
- Unprotects the worksheet.
ExcelCell
public ExcelCell()
- Constructs an ExcelCell object with
properties autoCreateSheet and autoUnprotectSheet set to
false. The range to be accessed needs to
be identified (by worksheetName and rangeName) and then
initialized before the properties of the cell can be accessed.
addExcelCellErrorListener
public synchronized void addExcelCellErrorListener(ExcelCellErrorListener l)
- Adds the specified ExcelCellErrorListener to receive
ExcelCellError events from the ExcelCell bean.
- Parameters:
- l - The ExcelCellErrorEvent listener.
- See Also:
- ExcelCellErrorEvent, ExcelCellErrorListener
addExcelSheetListener
public synchronized void addExcelSheetListener(ExcelSheetListener l)
- Adds the specified ExcelSheetListener to receive
ExcelSheet events from the ExcelRange bean.
- Parameters:
- l - The ExcelSheetEvent listener.
- See Also:
- ExcelSheetEvent, ExcelSheetListener
addFetchArgumentsListener
public synchronized void addFetchArgumentsListener(FetchArgumentsListener l)
- Adds the specified FetchArgumentsListener to receive
FetchArguments events from the ExcelRange bean.
- Parameters:
- l - The FetchArgumentsEvent listener.
- See Also:
- FetchArgumentsEvent, FetchArgumentsListener
addFetchPasswordListener
public synchronized void addFetchPasswordListener(FetchPasswordListener l)
- Adds the specified FetchPasswordListener to receive
FetchPassword events from the ExcelRange bean.
- Parameters:
- l - The FetchPasswordEvent listener.
- See Also:
- FetchPasswordEvent, FetchPasswordListener
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener l)
- Adds the specified PropertyChangeListener to receive
PropertyChange events from the ExcelRange bean.
- Parameters:
- l - The PropertyChangeEvent listener.
- See Also:
- PropertyChangeEvent, PropertyChangeListener
addExcelCellListener
public synchronized void addExcelCellListener(ExcelCellListener l)
- Adds the specified ExcelCellListener to receive
ExcelCell events from the ExcelCell bean.
- Parameters:
- l - the ExcelCellEvent listener.
- See Also:
- ExcelCellEvent, ExcelCellListener
clear
public synchronized void clear()
- Clears all the cell properties (value, formula,
format, text and noteText) for this Cell.
Fires ExcelCellErrorEvent on failure.
clearContents
public synchronized void clearContents()
- Clears the cell contents (value and formula, if any)
for this Cell. The format and noteText are retained.
Fires ExcelCellErrorEvent on failure.
clearFormats
public synchronized void clearFormats()
- Clears all cell formatting information for
this cell, the value, noteText
and formula are retained.
Fires ExcelCellErrorEvent on failure.
clearNotes
public synchronized void clearNotes()
- Clears notetext for this cell,
the value, formula and format information are
retained.
Fires ExcelCellErrorEvent on failure.
createNamedCell
public synchronized void createNamedCell(String name)
- Assigns a name to the current cell.
Fires ExcelCellErrorEvent on failure.
- Parameters:
- name - The name to be assigned to this cell.
getColumnHeaders
public synchronized Vector getColumnHeaders()
- Returns a Vector of Strings, which represents the headers of the
columns of the range (as integers).
- Returns:
- Vector of Strings containing the column headers.
getEndCol
public synchronized int getEndCol()
- Returns the column number for the bottom right cell of
the range.
- Returns:
- The column number for the bottom right cell of
the range.
getEndRow
public synchronized int getEndRow()
- Returns the row number for the bottom right cell of
the range.
- Returns:
- The row number for the bottom right cell of
the range.
getFormat
public synchronized String getFormat()
- Returns the Format property of the cell as a String.
- Returns:
- The format property as a String.
getFormula
public synchronized String getFormula()
- Returns the Formula property for the Cell as a String.
If the cell dos not contain a formula the value property
is returned as a String.
- Returns:
- The Formula as a String.
getNCols
public synchronized int getNCols()
- Returns the number of columns present in the range.
- Returns:
- The number of columns in the range.
getNoteText
public synchronized String getNoteText()
- Returns the noteText for the cell.
- Returns:
- The noteText property of the cell.
getNRows
public synchronized int getNRows()
- Returns the number of rows present in the range.
- Returns:
- The number of rows in the range.
getRangeName
public String getRangeName()
- Returns the name of the range if the
range has been selected using rangeName.
- Returns:
- The name of the range.
getRowHeaders
public synchronized Vector getRowHeaders()
- Returns a Vector of Strings, which represents the headers of the
rows of the range (as integers).
- Returns:
- Vector of Strings containing the row headers.
getStartCol
public synchronized int getStartCol()
- Returns the column number for the top left cell of
the range.
- Returns:
- The column number for the top left cell of
the range.
getStartRow
public synchronized int getStartRow()
- Returns the row number for the top left cell of
the range.
- Returns:
- The row number for the top left cell of
the range.
getText
public synchronized String getText()
- Returns the Text property for the Range.
- Returns:
- The text property of the range as a String.
getValue
public synchronized Object getValue()
- Returns the Value property for the Range. Value is returned as an
Object. Value can be of various
types such as String, Double, Date, Boolean. Blank cells are
returned as blank Strings. Time and currency
values are returned as double values.
- Returns:
- The value property as an Object.
getWorksheetName
public synchronized String getWorksheetName()
- Returns the name of the worksheet.
- Returns:
- The name of the worksheet.
hasArray
public synchronized Boolean hasArray()
- Method to check whether the cell is part of an array.
- Returns:
- True if this cell is part of an Array,
False otherwise.
hasFormula
public synchronized Boolean hasFormula()
- Method to check whether the cell contains
a formula.
- Returns:
- True if the cell contains a formula,
False otherwise.
initCell
public synchronized void initCell()
- A call to this method initializes the cell bean and
essentially turns it
on for further use. After the cell has been initialized,
the properties of the cell are available as bound properties
on this object. Calling this method fires FetchArgumentsEvent
which can be used to identify the cell/range to be initialized.
If the autoCreate flag is set to true, and if the worksheet does
not exist in the workbook, it is inserted in the workbook
during cell initialization. During sheet insertion, if the
workbook structure is protected, it is
automatically unprotected. If the sheet is
protected and
autoUnprotect is true it tries to
unprotect the sheet. If unprotection fails an error event is fired
and cell initialization continues.
This method has to be called before this bean can be used in
a valid manner to access the properties of the cell.
It fires cellInitialized( ExcelCellEvent ) on successful
initialization.
It fires ExcelCellErrorEvent on failure.
- See Also:
- FetchArgumentsEvent, ExcelCellErrorEvent, ExcelCellEvent
insertWorksheet
public synchronized void insertWorksheet()
- Inserts a new worksheet in the workbook and renames it to
the worksheetName of this range. The cell bean need not be
initialized to perform this operation. Before inserting
the sheet, the FetchArgumentsEvent is fired which can be
used to set the worksheetName. During insertion, if the
workbook structure is protected, it is
automatically unprotected. It fires sheetInserted( ExcelSheetEvent )
on success. It fires ExcelCellErrorEvent if an error occurs.
- See Also:
- ExcelSheetEvent
isInitialized
public boolean isInitialized()
- Returns the status of the initialization of the cell bean.
- Returns:
- True if the cell has been initialized, false
otherwise.
isAutoCreateSheet
public boolean isAutoCreateSheet()
- Returns the value of the autoCreateSheet property.
This property is used at the time of cell initialization.
- Returns:
- The
autoCreateSheet property.
isAutoUnprotectSheet
public boolean isAutoUnprotectSheet()
- Returns the value of the autoUnprotectSheet property.
This value is used only at the time of initializing the
cell.
- Returns:
- The
autoUnprotectSheet property.
propertyChange
public synchronized void propertyChange(PropertyChangeEvent evt)
- The listener method for property change events. This object
is a listener on the workbook bean. When the workbook changes,
the cell gets uninitialized and cellUninitialized( ExcelCellEvent )
is fired.
- Parameters:
- evt - The PropertyChangeEvent.
removeExcelCellErrorListener
public synchronized void removeExcelCellErrorListener(ExcelCellErrorListener l)
- Removes the specified ExcelCellErrorListener so that it no longer
receives ExcelCellErrorEvents from this bean.
- Parameters:
- l - The ExcelCellErrorListener.
- See Also:
- ExcelCellErrorEvent, ExcelCellErrorListener
removeExcelSheetListener
public synchronized void removeExcelSheetListener(ExcelSheetListener l)
- Removes the specified ExcelSheetListener so that it no longer
receives ExcelSheetEvents from this bean.
- Parameters:
- l - The ExcelSheetListener.
- See Also:
- ExcelSheetEvent, ExcelSheetListener
removeFetchArgumentsListener
public synchronized void removeFetchArgumentsListener(FetchArgumentsListener l)
- Removes the specified FetchArgumentsListener so that it no longer
receives FetchArgumentsEvents from this bean.
- Parameters:
- l - The FetchArgumentsListener.
- See Also:
- FetchArgumentsEvent, FetchArgumentsListener
removeFetchPasswordListener
public synchronized void removeFetchPasswordListener(FetchPasswordListener l)
- Removes the specified FetchPasswordListener so that it no longer
receives FetchPasswordEvents from this bean.
- Parameters:
- l - the FetchPasswordListener.
- See Also:
- FetchPasswordEvent, FetchPasswordListener
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener l)
- Removes the specified PropertyChangeListener so that it no longer
receives PropertyChangeEvents from this bean.
- Parameters:
- l - the PropertyChangeListener.
- See Also:
- PropertyChangeEvent, PropertyChangeListener
removeExcelCellListener
public synchronized void removeExcelCellListener(ExcelCellListener l)
- Removes the specified ExcelCellListener so that it no longer
receives ExcelCellEvents from this bean.
- Parameters:
- l - the ExcelCellListener.
- See Also:
- ExcelCellEvent, ExcelCellListener
removeWorksheet
public synchronized void removeWorksheet()
- Removes a worksheet from the workbook. The name of the sheet removed
is the property
worksheetName. The cell bean need not be
initialized to perform this operation. Before removing
the sheet, the FetchArgumentsEvent is fired which can be
used to set the worksheetName. During removal, if the
workbook structure is protected, it is
automatically unprotected. It fires sheetRemoved (ExcelSheetEvent)
on success. It fires ExcelCellErrorEvent if an error occurs.
- See Also:
- ExcelSheetEvent
setAutoCreateSheet
public synchronized void setAutoCreateSheet(boolean bValue)
- Sets the value of the autoCreateSheet property.
This property is used while initializing the cell.
If set to true, if the worksheet does not exist in the
workbook, it is automatically created.
- Parameters:
- bValue - The value to set.
setAutoUnprotectSheet
public synchronized void setAutoUnprotectSheet(boolean bValue)
- Sets the value of the autoUnprotectSheet property.
This value is used only at the time of initializing the
cell. If set to true, the worksheet is unprotected at
cell initialization.
- Parameters:
- bValue - The value to set.
setCellR1C1
public void setCellR1C1(int row,
int col)
- This method can be used to identify a single cell as the range
to be accessed using the cell row and column numbers.
- Parameters:
- row - The row number of the cell.
- col - The column number of the cell.
setFormat
public synchronized void setFormat(String strFormat)
- Sets the format property of this cell.
Fires ExcelCellErrorEvent on failure.
- Parameters:
- strFormat - String specifying the format.
setFormula
public synchronized void setFormula(String strFormula)
- Sets the formula property of the cell.
Fires ExcelCellErrorEvent on failure.
- Parameters:
- strFormula - A String specifying the formula.
setNoteText
public synchronized void setNoteText(String strText)
- Sets the noteText for the cell.
Fires ExcelCellErrorEvent on failure.
- Parameters:
- strText - String containing the noteText.
setRangeName
public void setRangeName(String strName)
- Sets the name of the Range to be accessed.
The name of the range can be a name that is previously assigned or an
"A1" style reference. Eg. A cell, say 'B4' would be referenced as "B4".
A range, say from cell 'B4' to cell 'F6', would be referenced as
"B4:F6". If the cell bean is initialized, calling this setter would result
in the cell bean becoming uninitialized.
If the range contains multiple contiguous cells (such as a range "B4:F6")
then the ExcelCell bean operates on the top-left cell of the range.
(Note: The beans do not have support for ranges that are composed
of multiple areas.)
- Parameters:
- strName - The name of the Range to be accessed.
setRangeR1C1
public void setRangeR1C1(int topRow,
int leftCol,
int bottomRow,
int rightCol)
- This method can be used to identify the range to be accessed
using the positions of the top-left and bottom-right cells.
If the range contains multiple contiguous cells
then the ExcelCell bean operates on the top-left cell of the range.
- Parameters:
- topRow - The row number of the top-left corner of
the range.
- leftCol - The column number of the top-left corner of
the range.
- bottomRow - The row number of the bottom right corner of
the range.
- rightCol - The column number of the bottom right corner of
the range.
setWorksheetProtectionPassword
public void setWorksheetProtectionPassword(String strPass)
- Sets the worksheet protection password to be used
while unprotecting the worksheet. Note that this
method does not change the worksheet protection
password in the Excel workbook, it simply uses the
supplied password, if required when unprotecting the
worksheet.
- Parameters:
- strPass - The worksheet protection password.
setValue
public synchronized void setValue(Object objValue)
- Sets the value property of this cell. Values supplied
can be of types Double, String, Boolean or Date. For
objects not of these types the toString() implementation is written
to the cell.
Fires ExcelCellErrorEvent on failure.
- Parameters:
- objValue - the Object containing the value to be written.
setWorksheetName
public void setWorksheetName(String strName)
- Sets the name of the worksheet to be accessed.
- Parameters:
- strName - The name of the worksheet to be accessed.
setXlWorkbook
public void setXlWorkbook(ExcelWorkbook workbookBean)
- Sets the reference to the ExcelWorkbook bean that this cell bean
operates on.
- Parameters:
- workbookBean - The ExcelWorkbook on which all operations will
be performed
unprotectWorksheet
public synchronized void unprotectWorksheet()
- Unprotects the worksheet. Throws a FetchPasswordEvent in case the
worksheet is password protected. Fires the ExcelCellErrorEvent
if unprotection fails.
All Packages Class Hierarchy This Package Previous Next Index