|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GenericWorkbook
Defines common interface behaviour for excel workbook. Can be implemented by embedded and standalone workbook implementation.
Method Summary | |
---|---|
void |
activate()
Activates the workbook. |
void |
addWorkbookEventListener(WorkbookEventListener eventListener)
Adds the listener of workbook events. |
Worksheet |
addWorksheet(java.lang.String name)
Adds a worksheet to the workbook. |
Worksheet |
addWorksheet(Worksheet after,
java.lang.String name)
Adds a worksheet to the workbook. |
void |
copyWorksheet(Worksheet worksheet,
Worksheet before,
Worksheet after)
Copies the worksheet to the position after the specified worksheet. |
Worksheet |
getActiveWorksheet()
Returns the active worksheet. |
Application |
getApplication()
Returns the parent application. |
java.lang.String |
getAuthor()
Returns the workbook author name. |
java.io.File |
getFile()
Returns the workbook file. |
FileFormat |
getFileFormat()
Returns the format of the workbook file. |
java.lang.String |
getTitle()
Returns the currently set title of the workbook. |
Window |
getWindow()
Returns the windows that corresponds to the workbook. |
java.lang.String |
getWorkbookName()
Returns the name of the workbook. |
Worksheet |
getWorksheet(int index)
Returns the worksheet that is specified by its index. |
Worksheet |
getWorksheet(java.lang.String name)
Returns the worksheet that is specified by its name. |
int |
getWorksheetCount()
Returns the number of worksheets in the workbook. |
java.util.List |
getWorksheets()
Returns the list of worksheets of the workbook. |
boolean |
hasPassword()
Returns true if the workbook has a password. |
boolean |
isClosed()
Checks if the workbook is closed. |
boolean |
isReadOnly()
Checks if the workbook is read only. |
boolean |
isSaved()
Checks if the workbook is saved (have not benn changed since the last save operation). |
void |
moveWorksheet(Worksheet worksheet,
Worksheet after)
Moves the worksheet to the position after the specified worksheet. |
void |
print(int copies)
Prints the specified number of copies of the workbook. |
void |
print(int firstSheet,
int lastSheet,
int copies)
Prints the specified range of worksheet. |
void |
removeEventHandler()
Removes the handler of workbook events. |
void |
removeWorkbookEventListener(WorkbookEventListener eventListener)
Removes the specified listener of workbook events. |
void |
removeWorksheet(Worksheet worksheet)
Removes the worksheet from the workbook. |
void |
saveCopyAs(java.io.File file)
Saves a copy of the workbook to another file. |
void |
setAuthor(java.lang.String author)
Specifies the workbook author name. |
void |
setEventHandler(WorkbookEventHandler eventHandler)
Specifies the handler of workbook events. |
void |
setPassword(java.lang.String password)
Sets up a new opening password of the workbook. |
void |
setTitle(java.lang.String title)
Sets up the title of the workbook. |
void |
setWritePassword(java.lang.String password)
Sets up a new write protection password of the workbook. |
Method Detail |
---|
Worksheet addWorksheet(java.lang.String name) throws ExcelException
name
- is the name of a new worksheet.
java.lang.IllegalStateException
- if the workbook is closed.
ExcelException
- if a worksheet with such name already exists in the workbook.Worksheet addWorksheet(Worksheet after, java.lang.String name) throws ExcelException
after
- the worksheet will be added to the position after this worksheet.
If the value is null
, the worksheet will be added
at the beginning of the worksheet list.name
- is the name of a new worksheet.
java.lang.IllegalStateException
- if the workbook is closed.
ExcelException
- if a worksheet with such name already exists in the workbook.Worksheet getWorksheet(java.lang.String name)
null
.
name
- is the name of the worksheet.
null
if such worksheet is not present.
java.lang.IllegalArgumentException
- if the name is null
.
java.lang.IllegalStateException
- if the workbook is closed.java.util.List getWorksheets()
Worksheet
class.
java.lang.IllegalStateException
- if the workbook is closed.Worksheet getWorksheet(int index)
index
- is the index of the worksheet.
java.lang.IndexOutOfBoundsException
- if there is no worksheet with such index.
java.lang.IllegalStateException
- if the workbook is closed.Worksheet getActiveWorksheet()
java.lang.IllegalStateException
- if the workbook is closed.void setEventHandler(WorkbookEventHandler eventHandler)
eventHandler
-
java.lang.IllegalStateException
- if the workbook is closed.void removeEventHandler()
java.lang.IllegalStateException
- if the workbook is closed.void addWorkbookEventListener(WorkbookEventListener eventListener)
eventListener
-
java.lang.IllegalStateException
- if the workbook is closed.void removeWorkbookEventListener(WorkbookEventListener eventListener)
eventListener
- is the listener to be removed.
java.lang.IllegalStateException
- if the workbook is closed.void setTitle(java.lang.String title)
title
- is a new title of the workbook.
java.lang.IllegalStateException
- if the workbook is closed.java.lang.String getTitle()
java.lang.IllegalStateException
- if the workbook is closed.java.io.File getFile()
java.lang.IllegalStateException
- if the workbook is closed.FileFormat getFileFormat()
java.lang.IllegalStateException
- if the workbook is closed.void print(int copies) throws javax.print.PrintException
copies
- is the number of copies to be printed.
java.lang.IllegalArgumentException
- if the number of copies is negative.
java.lang.IllegalStateException
- if the workbook is closed.
javax.print.PrintException
- if print problems occured.void print(int firstSheet, int lastSheet, int copies) throws javax.print.PrintException
firstSheet
- is the index of the first worksheet to be printed.lastSheet
- is the index of the last worksheet to be printed.copies
- is the number of copies to be printed.
java.lang.IllegalArgumentException
- if the number of copies is negative.
java.lang.IndexOutOfBoundsException
- if a worksheet index is illegal.
java.lang.IllegalStateException
- if the workbook is closed.
javax.print.PrintException
- if print problems occured.int getWorksheetCount()
java.lang.IllegalStateException
- if the workbook is closed.void setPassword(java.lang.String password)
password
- is a new password to be set up.
java.lang.IllegalStateException
- if the workbook is closed.boolean hasPassword()
true
if the workbook has a password.
true
if the workbook has a password.
java.lang.IllegalStateException
- if the workbook is closed.void setWritePassword(java.lang.String password)
password
- is a new write protection password
java.lang.IllegalStateException
- if the workbook is closed.java.lang.String getWorkbookName()
java.lang.IllegalStateException
- if the workbook is closed.boolean isReadOnly()
true
if the workbook is read only.
java.lang.IllegalStateException
- if the workbook is closed.boolean isSaved()
true
if the workbook is saved.
java.lang.IllegalStateException
- if the workbook is closed.boolean isClosed()
true
if the workbook is closed.void activate()
java.lang.IllegalStateException
- if the workbook is closed.Window getWindow()
java.lang.IllegalStateException
- if the workbook is closed.Window
java.lang.String getAuthor()
java.lang.IllegalStateException
- if the workbook is closed.void setAuthor(java.lang.String author)
author
- is the workbook author name.
java.lang.IllegalStateException
- if the workbook is closed.void removeWorksheet(Worksheet worksheet)
worksheet
- specifies the worksheet to be removed.
java.lang.IllegalArgumentException
- if the target worksheet is null
.void moveWorksheet(Worksheet worksheet, Worksheet after)
worksheet
- specifies the worksheet to be moved.after
- the worksheet will be moved to the position after this worksheet.
If the value is null
, the worksheet will be moved
to the beginning of the worksheet list.
java.lang.IllegalArgumentException
- if any target worksheet if null
.void copyWorksheet(Worksheet worksheet, Worksheet before, Worksheet after)
worksheet
- specifies the worksheet to be moved.before
- the worksheet will be moved to the position before this worksheet.
If the value is null
, after
parameter should be
specified.after
- the worksheet will be moved to the position after this worksheet.
If the value is null
, before
parameter should be
specified.
java.lang.IllegalArgumentException
- if any target worksheet if null
.Application getApplication()
void saveCopyAs(java.io.File file) throws java.io.IOException
file
- specifies the file name.
java.lang.IllegalStateException
- if the workbook is closed.
java.io.IOException
- if the workbook cannot be saved to the specified file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |