|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.util.ModifiableWorkbook
public class ModifiableWorkbook
Encapsulates a workbook from JExcel API that can be created from
an already existing file, modified, and written back to the input file.
JExcel API can be used to
read workbooks compatible with
Microsoft's Excel, or create workbooks from scratch.
However, modifying already existing workbooks
requires the original workbook to be read, changed
in a temporary file, and copied back to the
original location.
This class takes care of these steps.
After an instance is constructed using a file object,
the method getWorkbook()
can be used
to get the currently opened workbook.
The close()
method closes the workbook.
Constructor Summary | |
---|---|
ModifiableWorkbook(File outputFile)
Constructs a new modifiable workbook from the Excel file referred to by outputFile. |
|
ModifiableWorkbook(String outputFile)
Similar to the constructor ModifiableWorkbook(File) ,
with a string instead of a file object. |
Method Summary | |
---|---|
void |
close()
Closes the encapsulated workbook. |
void |
discardChanges()
Discards all the changes made in the encapsulated workbook. |
protected void |
finalize()
This method calls the close() method. |
File |
getOutputFile()
Returns a reference to the file object representing the output file. |
WritableWorkbook |
getWorkbook()
Returns a reference to the encapsulated workbook. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ModifiableWorkbook(File outputFile) throws IOException, jxl.read.biff.BiffException
outputFile
- the output file.
IOException
- if an error occurs when reading
the output file.
jxl.read.biff.BiffException
- if an error occurs
while parsing an existing workbook.public ModifiableWorkbook(String outputFile) throws IOException, jxl.read.biff.BiffException
ModifiableWorkbook(File)
,
with a string instead of a file object.
IOException
jxl.read.biff.BiffException
Method Detail |
---|
public WritableWorkbook getWorkbook()
IllegalStateException
- if this object is closed.public File getOutputFile()
IllegalStateException
- if this object is closed.public void close() throws WriteException, IOException
WritableWorkbook.write()
followed by WritableWorkbook.close()
on
the encapsulated workbook returned by getWorkbook()
.
If the workbook was created from another one,
the temporary file containing the written
workbook is copied back
to the output file returned by
getOutputFile()
.
WriteException
- if an error occurs while
formating the encapsulated workbook.
IOException
- if an error occurs while
writing the encapsulated workbook to disk.public void discardChanges() throws WriteException, IOException
WriteException
- if an error occurs while closing the workbook.
IOException
- if an error occurs while closing the workbook.protected void finalize() throws Throwable
close()
method.
finalize
in class Object
Throwable
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |