All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.excelaccessor.ExcelWorkbook
java.lang.Object
|
+----com.ibm.excelaccessor.ExcelWorkbook
- public class ExcelWorkbook
- extends Object
- implements Serializable
The ExcelWorkbook class is a bean belonging to the ExcelAccessor
bean suite. This class should be used along with the ExcelRange
bean to access the workbook.
This class handles all the Workbook operation such as
opening, saving and closing the workbook.
At the time of opening the workbook, it fires the FetchPassword
event if the Workbook has a protection password. It also fires
this event in case the Workbook has a write reservation password
and it is being opened in read-write mode. If the workbook is being
opened in the write mode, this bean ignores any readOnlyRecommended
status for the file. It also fires this event in case the Workbook
has a structure/window protection password for the workbook
modification such as inserting or removing a sheet.
At the time of closing the workbook, it throws a FileSavingEvent if
the file has been modified. This event could be wired to set the
saveOnClose property. By default, this property is set to true
(i.e. the workbook will be saved).
This bean automatically opens the workbook when it is first
accessed, if it has not already been opened specifically.
This class also contains methods that the other beans can call to
access the excel workbook. These methods in turn call the native
methods.
- See Also:
- FetchPasswordEvent, FetchPasswordListener, FileSavingEvent, FileSavingListener
-
ExcelWorkbook()
- Constructs an ExcelWorkbook with the readOnly and the saveOnClose
flags set to true.
-
addExcelWorkbookErrorListener(ExcelWorkbookErrorListener)
- Add the specified ExcelWorkbookError listener to receive
ExcelWorkbookError events from the ExcelWorkbook bean.
-
addExcelWorkbookListener(ExcelWorkbookListener)
- Adds the specified ExcelWorkbook listener to receive
ExcelWorkbook events from the ExcelWorkbook bean.
-
addFetchArgumentsListener(FetchArgumentsListener)
- Adds the specified FetchArguments listener to receive
FetchArgument events from the ExcelWorkbook bean.
-
addFetchPasswordListener(FetchPasswordListener)
- Adds the specified FetchPassword listener to receive
FetchPassword events from the ExcelWorkbook bean.
-
addFileSavingListener(FileSavingListener)
- Adds the specified FileSaving listener to receive
FileSaving events from the ExcelWorkbook bean.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds the specified PropertyChange listener to receive
PropertyChange events from the ExcelWorkbook bean.
-
closeWorkbook()
- The method to close the workbook.
-
finalize()
- The method is called by the garbage collector on an object when
garbage collection determines that there are no more references
to the object.
-
getThisWorkbook()
- Returns the reference to this workbook.
-
getWorkbookName()
- Returns the workbook name
-
getWorksheets()
- Returns the worksheets in the current workbook.
-
isOpened()
- Returns the status of the workbook
-
isReadOnly()
- Returns the flag indicating the workbook access mode.
-
isSaveOnClose()
- Returns the flag indicating whether the workbook should be
saved or not.
-
openWorkbook()
- This method is called to open the Workbook.
-
removeExcelWorkbookErrorListener(ExcelWorkbookErrorListener)
- Removes the specified ExcelWorkbookError listener so that it no longer
receives ExcelWorkbookError events from this bean.
-
removeExcelWorkbookListener(ExcelWorkbookListener)
- Removes the specified ExcelWorkbook listener so that it no longer
receives ExcelWorkbook events from this bean.
-
removeFetchArgumentsListener(FetchArgumentsListener)
- Removes the specified FetchArguments listener so that it no longer
receives FetchArguments events from this bean.
-
removeFetchPasswordListener(FetchPasswordListener)
- Removes the specified FetchPassword listener so that it no longer
receives FetchPassword events from this bean.
-
removeFileSavingListener(FileSavingListener)
- Removes the specified FileSaving listener so that it no longer
receives FileSaving events from this bean.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes the specified PropertyChange listener so that it no longer
receives PropertyChange events from this bean.
-
setReadOnly(boolean)
- Sets the flag indicating the mode that the workbook should be
opened in.
-
setSaveOnClose(boolean)
- Sets the flag indicating whether the workbook should be saved
before closing.
-
setWorkbookName(String)
- Sets the name of the workbook.
-
setWorkbookProtectionPassword(String)
- Sets the Workbook ProtectionPassword.
-
setWorkbookStructureProtectionPassword(String)
- Stores the Workbook StructureProtectionPassword.
-
setWorkbookWriteReservationPassword(String)
- Stores the Workbook WriteReservationPassword.
-
unprotectWorkbookStructure()
- This method unprotects the workbook structure/windows.
ExcelWorkbook
public ExcelWorkbook()
- Constructs an ExcelWorkbook with the readOnly and the saveOnClose
flags set to true.
addExcelWorkbookErrorListener
public synchronized void addExcelWorkbookErrorListener(ExcelWorkbookErrorListener l)
- Add the specified ExcelWorkbookError listener to receive
ExcelWorkbookError events from the ExcelWorkbook bean.
- Parameters:
- l - The ExcelAccessorErrorListener to be added
- See Also:
- ExcelWorkbookErrorEvent, ExcelWorkbookErrorListener
addExcelWorkbookListener
public synchronized void addExcelWorkbookListener(ExcelWorkbookListener l)
- Adds the specified ExcelWorkbook listener to receive
ExcelWorkbook events from the ExcelWorkbook bean.
- Parameters:
- l - the ExcelWorkbook listener.
- See Also:
- ExcelWorkbookEvent, ExcelWorkbookListener
addFetchArgumentsListener
public synchronized void addFetchArgumentsListener(FetchArgumentsListener l)
- Adds the specified FetchArguments listener to receive
FetchArgument events from the ExcelWorkbook bean.
- Parameters:
- l - The FetchArgumentsListener to be added.
- See Also:
- FetchArgumentsEvent, FetchArgumentsListener
addFetchPasswordListener
public synchronized void addFetchPasswordListener(FetchPasswordListener l)
- Adds the specified FetchPassword listener to receive
FetchPassword events from the ExcelWorkbook bean.
- Parameters:
- l - The FetchPasswordListener to be added.
- See Also:
- FetchPasswordEvent, FetchPasswordListener
addFileSavingListener
public synchronized void addFileSavingListener(FileSavingListener l)
- Adds the specified FileSaving listener to receive
FileSaving events from the ExcelWorkbook bean.
- Parameters:
- l - the FileSaving listener.
- See Also:
- FileSavingEvent, FileSavingListener
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener l)
- Adds the specified PropertyChange listener to receive
PropertyChange events from the ExcelWorkbook bean.
- Parameters:
- l - The PropertyChangeListener to be added
- See Also:
- PropertyChangeEvent, PropertyChangeListener
closeWorkbook
public synchronized void closeWorkbook()
- The method to close the workbook.
It throws a FileSavingEvent if the file has been modified.
The default value of the
saveOnClose flag is true.
This method should be called to ensure that changes made
to the workbook are not lost.
- See Also:
- FileSavingEvent, FileSavingListener
finalize
public void finalize()
- The method is called by the garbage collector on an object when
garbage collection determines that there are no more references
to the object. This method closes the Workbook if the workbook is
open.
- Overrides:
- finalize in class Object
getWorkbookName
public String getWorkbookName()
- Returns the workbook name
- Returns:
- The workbook name as a String
isOpened
public boolean isOpened()
- Returns the status of the workbook
- Returns:
- Returns true if the workbook is open
getThisWorkbook
public ExcelWorkbook getThisWorkbook()
- Returns the reference to this workbook.
- Returns:
- The
this workbook reference
getWorksheets
public synchronized String[] getWorksheets()
- Returns the worksheets in the current workbook.
This method must be called only after the workbook is open.
- Returns:
- The array of Strings that contains the list of worksheets.
null if the workbook is not open.
openWorkbook
public synchronized void openWorkbook()
- This method is called to open the Workbook. The method throws
the FetchPassword events if the passwords are required.
The workbook can be open in readonly or read/write mode as desired.
If workbook is opened successfully it fires the
workbookOpened (ExcelWorkbookEvent)
event to indicate the success. If the workbook is opened
successfully than it reads the name of all the worksheets in
this workbook.
This method throws ExcelWorkbookError event if any error occurs.
- See Also:
- FetchPasswordListener, ExcelWorkbookErrorListener
removeExcelWorkbookErrorListener
public synchronized void removeExcelWorkbookErrorListener(ExcelWorkbookErrorListener l)
- Removes the specified ExcelWorkbookError listener so that it no longer
receives ExcelWorkbookError events from this bean.
- Parameters:
- l - The ExcelWorkbookErrorListener to be removed
- See Also:
- ExcelWorkbookErrorEvent, ExcelWorkbookErrorListener
removeExcelWorkbookListener
public synchronized void removeExcelWorkbookListener(ExcelWorkbookListener l)
- Removes the specified ExcelWorkbook listener so that it no longer
receives ExcelWorkbook events from this bean.
- Parameters:
- l - The ExcelWorkbookListener to be removed
- See Also:
- ExcelWorkbookEvent, ExcelWorkbookListener
removeFetchArgumentsListener
public synchronized void removeFetchArgumentsListener(FetchArgumentsListener l)
- Removes the specified FetchArguments listener so that it no longer
receives FetchArguments events from this bean.
- Parameters:
- l - The FetchArgumentsListener to be removed
- See Also:
- FetchArgumentsEvent, FetchArgumentsListener
removeFetchPasswordListener
public synchronized void removeFetchPasswordListener(FetchPasswordListener l)
- Removes the specified FetchPassword listener so that it no longer
receives FetchPassword events from this bean.
- Parameters:
- l - The FetchPasswordListener to be removed
- See Also:
- FetchPasswordEvent, FetchPasswordListener
removeFileSavingListener
public synchronized void removeFileSavingListener(FileSavingListener l)
- Removes the specified FileSaving listener so that it no longer
receives FileSaving events from this bean.
- Parameters:
- l - The FileSavingListener to be removed
- See Also:
- FileSavingEvent, FileSavingListener
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener l)
- Removes the specified PropertyChange listener so that it no longer
receives PropertyChange events from this bean.
- Parameters:
- listener - The PropertyChangeListener to be removed
- See Also:
- PropertyChangeEvent, PropertyChangeListener
isReadOnly
public boolean isReadOnly()
- Returns the flag indicating the workbook access mode.
- Returns:
- The
readOnly property
isSaveOnClose
public boolean isSaveOnClose()
- Returns the flag indicating whether the workbook should be
saved or not.
- Returns:
- The
saveOnClose property
setReadOnly
public void setReadOnly(boolean b)
- Sets the flag indicating the mode that the workbook should be
opened in. This method closes the workbook if it is currently open.
The default value of this property is true.
- Parameters:
- b - The boolean parameter
setSaveOnClose
public void setSaveOnClose(boolean b)
- Sets the flag indicating whether the workbook should be saved
before closing. The default value of this property is true.
- Parameters:
- b - The boolean parameter
setWorkbookName
public void setWorkbookName(String name)
- Sets the name of the workbook. This method closes the workbook
if it is currently open.
- Parameters:
- name - The String specifying the workbookName
setWorkbookProtectionPassword
public void setWorkbookProtectionPassword(String pass)
- Sets the Workbook ProtectionPassword.
- Parameters:
- pass - The String specifying the workbookProtection password
setWorkbookStructureProtectionPassword
public void setWorkbookStructureProtectionPassword(String pass)
- Stores the Workbook StructureProtectionPassword.
- Parameters:
- pass - The String specifying the workbookStructureProtection
password
setWorkbookWriteReservationPassword
public void setWorkbookWriteReservationPassword(String pass)
- Stores the Workbook WriteReservationPassword.
- Parameters:
- pass - The String specifying the
workbookWriteReservationProtection password
unprotectWorkbookStructure
public synchronized void unprotectWorkbookStructure()
- This method unprotects the workbook structure/windows. The method
throws the FetchPassword event if a password is required.
- See Also:
- FetchPasswordListener
All Packages Class Hierarchy This Package Previous Next Index